Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b7eaf6f

Browse files
committed
deps/reftable: drop Git-specific QSORT macro in the writer code
The reftable writer accidentally uses the Git-specific `QSORT()` macro. This macro removes the need for the caller to provide the element size, but other than that it's mostly equivalent to `qsort()`. Replace the macro accordingly. This incompatibility is a bug in Git that needs to be fixed upstream.
1 parent f891151 commit b7eaf6f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

deps/reftable/writer.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,10 @@ int reftable_writer_add_refs(struct reftable_writer *w,
399399
{
400400
int err = 0;
401401
int i = 0;
402-
QSORT(refs, n, reftable_ref_record_compare_name);
402+
403+
if (n > 1)
404+
qsort(refs, n, sizeof(*refs), reftable_ref_record_compare_name);
405+
403406
for (i = 0; err == 0 && i < n; i++) {
404407
err = reftable_writer_add_ref(w, &refs[i]);
405408
}
@@ -490,7 +493,9 @@ int reftable_writer_add_logs(struct reftable_writer *w,
490493
{
491494
int err = 0;
492495
int i = 0;
493-
QSORT(logs, n, reftable_log_record_compare_key);
496+
497+
if (n > 1)
498+
qsort(logs, n, sizeof(*logs), reftable_log_record_compare_key);
494499

495500
for (i = 0; err == 0 && i < n; i++) {
496501
err = reftable_writer_add_log(w, &logs[i]);

0 commit comments

Comments
 (0)