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
@ -158,10 +158,7 @@ static struct spanhash_top *hash_chars(struct diff_filespec *one)
|
||||
n = 0;
|
||||
accum1 = accum2 = 0;
|
||||
}
|
||||
qsort(hash->data,
|
||||
1ul << hash->alloc_log2,
|
||||
sizeof(hash->data[0]),
|
||||
spanhash_cmp);
|
||||
QSORT(hash->data, 1ul << hash->alloc_log2, spanhash_cmp);
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user