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
@ -446,8 +446,7 @@ void parse_pathspec(struct pathspec *pathspec,
|
||||
if (pathspec->magic & PATHSPEC_MAXDEPTH) {
|
||||
if (flags & PATHSPEC_KEEP_ORDER)
|
||||
die("BUG: PATHSPEC_MAXDEPTH_VALID and PATHSPEC_KEEP_ORDER are incompatible");
|
||||
qsort(pathspec->items, pathspec->nr,
|
||||
sizeof(struct pathspec_item), pathspec_item_cmp);
|
||||
QSORT(pathspec->items, pathspec->nr, pathspec_item_cmp);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user