From e32b4b69cdf55bb73638021b01f2be7d4b165be9 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Thu, 23 Oct 2025 05:23:27 +0000 Subject: Fix qsort_r sysdep detection --- src/sysdeps/tryqsortr_posix.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/sysdeps/tryqsortr_posix.c') diff --git a/src/sysdeps/tryqsortr_posix.c b/src/sysdeps/tryqsortr_posix.c index 63c1d60..81af081 100644 --- a/src/sysdeps/tryqsortr_posix.c +++ b/src/sysdeps/tryqsortr_posix.c @@ -1,19 +1,25 @@ /* ISC license. */ +#undef _POSIX_C_SOURCE +#undef _XOPEN_SOURCE +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif + #include static int f (void const *a, void const *b, void *c) { - int aa = *(int *)a ; - int bb = *(int *)b ; + int aa = *(int const *)a ; + int bb = *(int const *)b ; (void)c ; return aa < bb ? -1 : aa > bb ; } int main (void) { - char *x = "blah" ; + char *arg = "blah" ; int x[2] = { 2, 1 } ; - qsort_r(x, 2, sizeof(int), &f, x) ; + qsort_r(x, 2, sizeof(int), &f, arg) ; return 0 ; } -- cgit v1.3.1