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
2
bisect.c
2
bisect.c
@ -215,7 +215,7 @@ static struct commit_list *best_bisection_sorted(struct commit_list *list, int n
|
||||
array[cnt].distance = distance;
|
||||
cnt++;
|
||||
}
|
||||
qsort(array, cnt, sizeof(*array), compare_commit_dist);
|
||||
QSORT(array, cnt, compare_commit_dist);
|
||||
for (p = list, i = 0; i < cnt; i++) {
|
||||
char buf[100]; /* enough for dist=%d */
|
||||
struct object *obj = &(array[i].commit->object);
|
||||
|
Reference in New Issue
Block a user