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
@ -61,8 +61,7 @@ const char *write_idx_file(const char *index_name, struct pack_idx_entry **objec
|
||||
if (objects[i]->offset > last_obj_offset)
|
||||
last_obj_offset = objects[i]->offset;
|
||||
}
|
||||
qsort(sorted_by_sha, nr_objects, sizeof(sorted_by_sha[0]),
|
||||
sha1_compare);
|
||||
QSORT(sorted_by_sha, nr_objects, sha1_compare);
|
||||
}
|
||||
else
|
||||
sorted_by_sha = list = last = NULL;
|
||||
|
Reference in New Issue
Block a user