remove unnecessary check before QSORT
Add a semantic patch for removing checks similar to the one that QSORT already does internally and apply it to the code base. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
9ed0d8d6e6
commit
76dd98c139
@ -314,10 +314,8 @@ static void add_people_info(struct strbuf *out,
|
||||
struct string_list *authors,
|
||||
struct string_list *committers)
|
||||
{
|
||||
if (authors->nr)
|
||||
QSORT(authors->items, authors->nr,
|
||||
cmp_string_list_util_as_integral);
|
||||
if (committers->nr)
|
||||
QSORT(committers->items, committers->nr,
|
||||
cmp_string_list_util_as_integral);
|
||||
|
||||
|
@ -17,3 +17,21 @@ expression nmemb, compar;
|
||||
@@
|
||||
- qsort(base, nmemb, sizeof(T), compar);
|
||||
+ QSORT(base, nmemb, compar);
|
||||
|
||||
@@
|
||||
expression base, nmemb, compar;
|
||||
@@
|
||||
- if (nmemb)
|
||||
QSORT(base, nmemb, compar);
|
||||
|
||||
@@
|
||||
expression base, nmemb, compar;
|
||||
@@
|
||||
- if (nmemb > 0)
|
||||
QSORT(base, nmemb, compar);
|
||||
|
||||
@@
|
||||
expression base, nmemb, compar;
|
||||
@@
|
||||
- if (nmemb > 1)
|
||||
QSORT(base, nmemb, compar);
|
||||
|
@ -230,7 +230,6 @@ cmp_string (const void *pstr1, const void *pstr2)
|
||||
static inline void
|
||||
string_list_sort (string_list_ty *slp)
|
||||
{
|
||||
if (slp->nitems > 0)
|
||||
QSORT(slp->item, slp->nitems, cmp_string);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user