Skip to content

Commit 1b5294d

Browse files
rscharfegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a9a884a commit 1b5294d

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

builtin/index-pack.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,8 +1531,7 @@ static void read_v2_anomalous_offsets(struct packed_git *p,
15311531
opts->anomaly[opts->anomaly_nr++] = ntohl(idx2[off * 2 + 1]);
15321532
}
15331533

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);
15361535
}
15371536

15381537
static void read_idx_option(struct pack_idx_option *opts, const char *pack_name)

builtin/shortlog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ void shortlog_output(struct shortlog *log)
308308
struct strbuf sb = STRBUF_INIT;
309309

310310
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,
312312
log->summary ? compare_by_counter : compare_by_list);
313313
for (i = 0; i < log->list.nr; i++) {
314314
const struct string_list_item *item = &log->list.items[i];

0 commit comments

Comments
 (0)