Skip to content

Commit 2ecf339

Browse files
committed
fix a bug in the invokation of qsort_s
Reported in romkatv/gitstatus#414
1 parent 0ad3d77 commit 2ecf339

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/util.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,13 @@ static int GIT_STDLIB_CALL git__qsort_r_glue_cmp(
693693
git__qsort_r_glue *glue = payload;
694694
return glue->cmp(a, b, glue->payload);
695695
}
696+
697+
static int GIT_STDLIB_CALL git__qsort_s_glue_cmp(
698+
const void *a, const void *b, void *payload)
699+
{
700+
git__qsort_r_glue *glue = payload;
701+
return glue->cmp(a, b, glue->payload);
702+
}
696703
#endif
697704

698705

@@ -736,7 +743,7 @@ void git__qsort_r(
736743
qsort_r(els, nel, elsize, cmp, payload);
737744
#elif defined(HAVE_QSORT_S)
738745
git__qsort_r_glue glue = { cmp, payload };
739-
qsort_s(els, nel, elsize, git__qsort_r_glue_cmp, &glue);
746+
qsort_s(els, nel, elsize, git__qsort_s_glue_cmp, &glue);
740747
#else
741748
insertsort(els, nel, elsize, cmp, payload);
742749
#endif

0 commit comments

Comments
 (0)