Whamcloud - gitweb
libsupport: fix sort_r.h to work on FreeBSD 14
authorTheodore Ts'o <tytso@mit.edu>
Sun, 21 Apr 2024 05:07:14 +0000 (01:07 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 21 Apr 2024 05:07:14 +0000 (01:07 -0400)
FreeBSD 14 has changed the definition of qsort_r to align it with the
POSIX, but it did this with a #define.  So when sort_r.h tries to
provide a function prototype, surround the function name with
parenthesis so it doesn't get expanded by FreeBSD's #define.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/support/sort_r.h

index 8473ca8..660294e 100644 (file)
@@ -267,7 +267,7 @@ static _SORT_R_INLINE void sort_r_simple(void *base, size_t nel, size_t w,
   #if defined _SORT_R_GNU
 
     typedef int(* __compar_d_fn_t)(const void *, const void *, void *);
-    extern void qsort_r(void *base, size_t nel, size_t width,
+    extern void (qsort_r)(void *base, size_t nel, size_t width,
                         __compar_d_fn_t __compar, void *arg)
       __attribute__((nonnull (1, 4)));