reftable/writer: drop Git-specific QSORT() macro

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 to make the library usable outside of Git.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Patrick Steinhardt
2025-08-12 11:54:16 +02:00
committed by Junio C Hamano
parent 9077923c8e
commit d4a2159a78

View File

@@ -399,7 +399,8 @@ int reftable_writer_add_refs(struct reftable_writer *w,
{
int err = 0;
QSORT(refs, n, reftable_ref_record_compare_name);
if (n)
qsort(refs, n, sizeof(*refs), reftable_ref_record_compare_name);
for (size_t i = 0; err == 0 && i < n; i++)
err = reftable_writer_add_ref(w, &refs[i]);
@@ -491,7 +492,8 @@ int reftable_writer_add_logs(struct reftable_writer *w,
{
int err = 0;
QSORT(logs, n, reftable_log_record_compare_key);
if (n)
qsort(logs, n, sizeof(*logs), reftable_log_record_compare_key);
for (size_t i = 0; err == 0 && i < n; i++)
err = reftable_writer_add_log(w, &logs[i]);