Skip to content

Commit 290e692

Browse files
authored
Merge pull request #4463 from brad0/gnu_source_qsort
Check for build environment instead of just _GNU_SOURCE
2 parents b3f134b + 0d1f8de commit 290e692

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lib/dictBuilder/cover.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@
2121
/*-*************************************
2222
* Dependencies
2323
***************************************/
24-
/* qsort_r is an extension. */
25-
#if defined(__linux) || defined(__linux__) || defined(linux) || defined(__gnu_linux__) || \
26-
defined(__CYGWIN__) || defined(__MSYS__)
27-
# if !defined(_GNU_SOURCE) && !defined(__ANDROID__) /* NDK doesn't ship qsort_r(). */
24+
/* qsort_r is an extension.
25+
*
26+
* Android NDK does not ship qsort_r().
27+
*/
28+
#if (defined(__linux__) && !defined(__ANDROID__)) || defined(__CYGWIN__) || defined(__MSYS__)
29+
# ifndef _GNU_SOURCE
2830
# define _GNU_SOURCE
2931
# endif
3032
#endif
@@ -77,7 +79,7 @@
7779
#ifndef ZDICT_QSORT
7880
# if defined(__APPLE__)
7981
# define ZDICT_QSORT ZDICT_QSORT_APPLE /* uses qsort_r() with a different order for parameters */
80-
# elif defined(_GNU_SOURCE)
82+
# elif (defined(__linux__) && !defined(__ANDROID__)) || defined(__CYGWIN__) || defined(__MSYS__)
8183
# define ZDICT_QSORT ZDICT_QSORT_GNU /* uses qsort_r() */
8284
# elif defined(_WIN32) && defined(_MSC_VER)
8385
# define ZDICT_QSORT ZDICT_QSORT_MSVC /* uses qsort_s() with a different order for parameters */

0 commit comments

Comments
 (0)