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:
René Scharfe
2016-09-29 17:27:31 +02:00
committed by Junio C Hamano
parent dbc540c7a5
commit 9ed0d8d6e6
30 changed files with 44 additions and 65 deletions

View File

@@ -46,7 +46,7 @@ static void write_tree(unsigned char *sha1)
size_t size;
int i;
qsort(entries, used, sizeof(*entries), ent_compare);
QSORT(entries, used, ent_compare);
for (size = i = 0; i < used; i++)
size += 32 + entries[i]->len;