use QSORT, part 2
authorRené Scharfe <l.s.r@web.de>
Thu, 29 Sep 2016 23:40:14 +0000 (01:40 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 30 Sep 2016 03:40:23 +0000 (20:40 -0700)
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>
builtin/index-pack.c
builtin/shortlog.c
index 7657d0a75b6a10c797f75794d9aca9bb3d2e9bd1..0a27bab11b6b5a1b162c4dfef34c645c7d5f14ad 100644 (file)
@@ -1531,8 +1531,7 @@ static void read_v2_anomalous_offsets(struct packed_git *p,
                opts->anomaly[opts->anomaly_nr++] = ntohl(idx2[off * 2 + 1]);
        }
 
-       if (1 < opts->anomaly_nr)
-               qsort(opts->anomaly, opts->anomaly_nr, sizeof(uint32_t), cmp_uint32);
+       QSORT(opts->anomaly, opts->anomaly_nr, cmp_uint32);
 }
 
 static void read_idx_option(struct pack_idx_option *opts, const char *pack_name)
index 25fa8a6aed72bb91c3b99121059a90cc976976a5..ba0e1154a9f0b95f60e5bcb6cdb716bf0f6ef366 100644 (file)
@@ -308,7 +308,7 @@ void shortlog_output(struct shortlog *log)
        struct strbuf sb = STRBUF_INIT;
 
        if (log->sort_by_number)
-               qsort(log->list.items, log->list.nr, sizeof(struct string_list_item),
+               QSORT(log->list.items, log->list.nr,
                      log->summary ? compare_by_counter : compare_by_list);
        for (i = 0; i < log->list.nr; i++) {
                const struct string_list_item *item = &log->list.items[i];