diff options
Diffstat (limited to 'lib/support/sort_r.h')
-rw-r--r-- | lib/support/sort_r.h | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/support/sort_r.h b/lib/support/sort_r.h index dc17e8af..8473ca83 100644 --- a/lib/support/sort_r.h +++ b/lib/support/sort_r.h @@ -24,12 +24,16 @@ void sort_r(void *base, size_t nel, size_t width, #define _SORT_R_INLINE inline -#if (defined __APPLE__ || defined __MACH__ || defined __DARWIN__ || \ +#if (defined HAVE_GNU_QSORT_R) +# define _SORT_R_GNU +#elif (defined HAVE_BSD_QSORT_R) +# define _SORT_R_BSD +#elif (defined __gnu_hurd__ || defined __GNU__ || \ + defined __MINGW32__ || defined __GLIBC__) +# define _SORT_R_GNU +#elif (defined __APPLE__ || defined __MACH__ || defined __DARWIN__ || \ defined __FreeBSD__ || defined __DragonFly__) # define _SORT_R_BSD -#elif (defined _GNU_SOURCE || defined __gnu_hurd__ || defined __GNU__ || \ - defined __linux__ || defined __MINGW32__ || defined __GLIBC__) -# define _SORT_R_LINUX #elif (defined _WIN32 || defined _WIN64 || defined __WINDOWS__) # define _SORT_R_WINDOWS # undef _SORT_R_INLINE @@ -260,7 +264,7 @@ static _SORT_R_INLINE void sort_r_simple(void *base, size_t nel, size_t w, #endif - #if defined _SORT_R_LINUX + #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, @@ -276,7 +280,7 @@ static _SORT_R_INLINE void sort_r_simple(void *base, size_t nel, size_t w, const void *_b, void *_arg), void *arg) { - #if defined _SORT_R_LINUX + #if defined _SORT_R_GNU #if defined __GLIBC__ && ((__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 8)) @@ -315,7 +319,7 @@ static _SORT_R_INLINE void sort_r_simple(void *base, size_t nel, size_t w, #undef _SORT_R_INLINE #undef _SORT_R_WINDOWS -#undef _SORT_R_LINUX +#undef _SORT_R_GNU #undef _SORT_R_BSD #endif /* SORT_R_H_ */ |