Skip to content

Commit 121c72d

Browse files
committed
zstd: cherry-pick qsort commit
This change reflects a cherry-pick of the following upstream commit from facebook/zstd#4463: * 0d1f8de9addeb2fcb53f1a6a68ef4ac505253c0e This commit is necessary to fix building on OpenBSD and NetBSD. Python sets _GNU_SOURCE breaking the build.
1 parent 3aa6222 commit 121c72d

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

zstd/zstd.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,8 @@
8585
* header and the script 'combine.sh' combines the whole zstd source code
8686
* in a single file.
8787
*/
88-
#if defined(__linux) || defined(__linux__) || defined(linux) || defined(__gnu_linux__) || \
89-
defined(__CYGWIN__) || defined(__MSYS__)
90-
#if !defined(_GNU_SOURCE) && !defined(__ANDROID__) /* NDK doesn't ship qsort_r(). */
88+
#if (defined(__linux__) && !defined(__ANDROID__)) || defined(__CYGWIN__) || defined(__MSYS__)
89+
#ifndef _GNU_SOURCE
9190
#define _GNU_SOURCE
9291
#endif
9392
#endif
@@ -47866,10 +47865,12 @@ size_t ZSTD_decompressBlock(ZSTD_DCtx* dctx,
4786647865
/*-*************************************
4786747866
* Dependencies
4786847867
***************************************/
47869-
/* qsort_r is an extension. */
47870-
#if defined(__linux) || defined(__linux__) || defined(linux) || defined(__gnu_linux__) || \
47871-
defined(__CYGWIN__) || defined(__MSYS__)
47872-
# if !defined(_GNU_SOURCE) && !defined(__ANDROID__) /* NDK doesn't ship qsort_r(). */
47868+
/* qsort_r is an extension.
47869+
*
47870+
* Android NDK does not ship qsort_r().
47871+
*/
47872+
#if (defined(__linux__) && !defined(__ANDROID__)) || defined(__CYGWIN__) || defined(__MSYS__)
47873+
# ifndef _GNU_SOURCE
4787347874
# define _GNU_SOURCE
4787447875
# endif
4787547876
#endif
@@ -48557,7 +48558,7 @@ void COVER_dictSelectionFree(COVER_dictSelection_t selection);
4855748558
#ifndef ZDICT_QSORT
4855848559
# if defined(__APPLE__)
4855948560
# define ZDICT_QSORT ZDICT_QSORT_APPLE /* uses qsort_r() with a different order for parameters */
48560-
# elif defined(_GNU_SOURCE)
48561+
# elif (defined(__linux__) && !defined(__ANDROID__)) || defined(__CYGWIN__) || defined(__MSYS__)
4856148562
# define ZDICT_QSORT ZDICT_QSORT_GNU /* uses qsort_r() */
4856248563
# elif defined(_WIN32) && defined(_MSC_VER)
4856348564
# define ZDICT_QSORT ZDICT_QSORT_MSVC /* uses qsort_s() with a different order for parameters */

0 commit comments

Comments
 (0)