Skip to content

Commit

Permalink
fix a bug in the invokation of qsort_s
Browse files Browse the repository at this point in the history
  • Loading branch information
romkatv committed Dec 10, 2023
1 parent 0ad3d77 commit 2ecf339
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,13 @@ static int GIT_STDLIB_CALL git__qsort_r_glue_cmp(
git__qsort_r_glue *glue = payload;
return glue->cmp(a, b, glue->payload);
}

static int GIT_STDLIB_CALL git__qsort_s_glue_cmp(
const void *a, const void *b, void *payload)
{
git__qsort_r_glue *glue = payload;
return glue->cmp(a, b, glue->payload);
}
#endif


Expand Down Expand Up @@ -736,7 +743,7 @@ void git__qsort_r(
qsort_r(els, nel, elsize, cmp, payload);
#elif defined(HAVE_QSORT_S)
git__qsort_r_glue glue = { cmp, payload };
qsort_s(els, nel, elsize, git__qsort_r_glue_cmp, &glue);
qsort_s(els, nel, elsize, git__qsort_s_glue_cmp, &glue);
#else
insertsort(els, nel, elsize, cmp, payload);
#endif
Expand Down

0 comments on commit 2ecf339

Please sign in to comment.