use QSORT
Apply the semantic patch contrib/coccinelle/qsort.cocci to the code base, replacing calls of qsort(3) with QSORT. The resulting code is shorter and supports empty arrays with NULL pointers. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
dbc540c7a5
commit
9ed0d8d6e6
@ -225,7 +225,7 @@ static int cmp_items(const void *a, const void *b)
|
||||
void string_list_sort(struct string_list *list)
|
||||
{
|
||||
compare_for_qsort = list->cmp ? list->cmp : strcmp;
|
||||
qsort(list->items, list->nr, sizeof(*list->items), cmp_items);
|
||||
QSORT(list->items, list->nr, cmp_items);
|
||||
}
|
||||
|
||||
struct string_list_item *unsorted_string_list_lookup(struct string_list *list,
|
||||
|
||||
Reference in New Issue
Block a user