]> git.ipfire.org Git - thirdparty/git.git/commit - merge-recursive.c
merge-recursive.c: use string_list_sort instead of qsort
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Thu, 24 Nov 2016 11:45:36 +0000 (18:45 +0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 28 Nov 2016 23:30:17 +0000 (15:30 -0800)
commitfa6ca11105ccb46b785fd4ed58c333d5ad7f1774
tree12367cdeb454f55591ec88b59f91e53a7c62e529
parentac84098b7e32406a982ac01cc76a663d5605224b
merge-recursive.c: use string_list_sort instead of qsort

Merge-recursive sorts a string list using a raw qsort(), where it
feeds the "items" from one struct but the "nr" and size fields from
another struct. This isn't a bug because one list is a copy of the
other, but it's unnecessarily confusing (and also caused our recent
QSORT() cleanups via coccinelle to miss this call site).

Let's use string_list_sort() instead, which is more concise and harder
to get wrong. Note that we need to adjust our comparison function,
which gets fed only the strings now, not the string_list_items. That's
OK because we don't use the "util" field as part of our sort.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
merge-recursive.c