use QSORT, part 2
Convert two more qsort(3) calls to QSORT to reduce code size and for better safety and consistency. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe committed
Sep 30, 2016 at 01:40 UTC
1b5294de406146c4ec321a59e07a5566c435cc2e
2 files changed
+2
-3
builtin/index-pack.c
+1
-2
@@ -1531,8 +1531,7 @@ static void read_v2_anomalous_offsets(struct packed_git *p,
1531
opts->anomaly[opts->anomaly_nr++] = ntohl(idx2[off * 2 + 1]);
1532
}
1533
1534
- if (1 < opts->anomaly_nr)
1535
- qsort(opts->anomaly, opts->anomaly_nr, sizeof(uint32_t), cmp_uint32);
1534
+ QSORT(opts->anomaly, opts->anomaly_nr, cmp_uint32);
1535
}
1536
1537
static void read_idx_option(struct pack_idx_option *opts, const char *pack_name)
builtin/shortlog.c
+1
-1
@@ -308,7 +308,7 @@ void shortlog_output(struct shortlog *log)
308
struct strbuf sb = STRBUF_INIT;
309
310
if (log->sort_by_number)
311
- qsort(log->list.items, log->list.nr, sizeof(struct string_list_item),
311
+ QSORT(log->list.items, log->list.nr,
312
log->summary ? compare_by_counter : compare_by_list);
313
for (i = 0; i < log->list.nr; i++) {
314
const struct string_list_item *item = &log->list.items[i];