From 2ecf33948a4df9ef45a66c68b8ef24a5e60eaac6 Mon Sep 17 00:00:00 2001 From: Roman Perepelitsa Date: Sun, 10 Dec 2023 12:03:56 +0100 Subject: [PATCH] fix a bug in the invokation of qsort_s Reported in https://github.com/romkatv/gitstatus/issues/414 --- src/util.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/util.c b/src/util.c index 5bf1a233992..5488ef4141e 100644 --- a/src/util.c +++ b/src/util.c @@ -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 @@ -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