From fc726da7747b159520de2edb0febab30342d2744 Mon Sep 17 00:00:00 2001 From: Victor Zhang Date: Tue, 17 Dec 2024 17:55:07 -0800 Subject: [PATCH] Move #includes out of `extern "C"` blocks Do some include shuffling for `**.h` files within lib, programs, tests, and zlibWrapper. `lib/legacy` and `lib/deprecated` are untouched. `#include`s within `extern "C"` blocks in .cpp files are untouched. todo: shuffling for `xxhash.h` --- contrib/seekable_format/zstd_seekable.h | 6 +++--- lib/common/bitstream.h | 8 ++++---- lib/common/debug.h | 9 ++++----- lib/common/error_private.h | 8 +++----- lib/common/fse.h | 16 +++++++-------- lib/common/huf.h | 7 +++---- lib/common/mem.h | 8 ++++---- lib/common/pool.h | 8 ++++---- lib/common/threading.h | 27 +++++++++++++++++++++---- lib/common/zstd_trace.h | 4 ++-- lib/compress/zstd_double_fast.h | 6 +++--- lib/compress/zstd_fast.h | 6 +++--- lib/compress/zstd_lazy.h | 4 ++-- lib/compress/zstd_ldm.h | 6 +++--- lib/compress/zstd_opt.h | 4 ++-- lib/compress/zstdmt_compress.h | 11 +++++----- lib/zdict.h | 8 ++++---- lib/zstd.h | 15 ++++++++------ programs/benchfn.h | 8 ++++---- programs/benchzstd.h | 8 ++++---- programs/fileio_asyncio.h | 8 ++++---- programs/fileio_common.h | 16 ++++++++++----- programs/platform.h | 21 +++++++++---------- programs/timefn.h | 11 +++++----- programs/util.c | 9 --------- programs/util.h | 4 +++- zlibWrapper/zstd_zlibwrapper.h | 10 ++++----- 27 files changed, 135 insertions(+), 121 deletions(-) diff --git a/contrib/seekable_format/zstd_seekable.h b/contrib/seekable_format/zstd_seekable.h index a0e5e3573..b1f83d0e0 100644 --- a/contrib/seekable_format/zstd_seekable.h +++ b/contrib/seekable_format/zstd_seekable.h @@ -1,13 +1,13 @@ #ifndef SEEKABLE_H #define SEEKABLE_H +#include +#include "zstd.h" /* ZSTDLIB_API */ + #if defined (__cplusplus) extern "C" { #endif -#include -#include "zstd.h" /* ZSTDLIB_API */ - #define ZSTD_seekTableFooterSize 9 diff --git a/lib/common/bitstream.h b/lib/common/bitstream.h index 676044989..bce91e801 100644 --- a/lib/common/bitstream.h +++ b/lib/common/bitstream.h @@ -14,9 +14,6 @@ #ifndef BITSTREAM_H_MODULE #define BITSTREAM_H_MODULE -#if defined (__cplusplus) -extern "C" { -#endif /* * This API consists of small unitary functions, which must be inlined for best performance. * Since link-time-optimization is not available for all compilers, @@ -32,7 +29,6 @@ extern "C" { #include "error_private.h" /* error codes and messages */ #include "bits.h" /* ZSTD_highbit32 */ - /*========================================= * Target specific =========================================*/ @@ -44,6 +40,10 @@ extern "C" { # endif #endif +#if defined (__cplusplus) +extern "C" { +#endif + #define STREAM_ACCUMULATOR_MIN_32 25 #define STREAM_ACCUMULATOR_MIN_64 57 #define STREAM_ACCUMULATOR_MIN ((U32)(MEM_32bits() ? STREAM_ACCUMULATOR_MIN_32 : STREAM_ACCUMULATOR_MIN_64)) diff --git a/lib/common/debug.h b/lib/common/debug.h index a16b69e57..8ef37a908 100644 --- a/lib/common/debug.h +++ b/lib/common/debug.h @@ -32,10 +32,6 @@ #ifndef DEBUG_H_12987983217 #define DEBUG_H_12987983217 -#if defined (__cplusplus) -extern "C" { -#endif - /* static assert is triggered at compile time, leaving no runtime artefact. * static assert only works with compile-time constants. @@ -75,9 +71,12 @@ extern "C" { # endif #endif +#if defined (__cplusplus) +extern "C" { +#endif + #if (DEBUGLEVEL>=2) # define ZSTD_DEPS_NEED_IO -# include "zstd_deps.h" extern int g_debuglevel; /* the variable is only declared, it actually lives in debug.c, and is shared by the whole process. diff --git a/lib/common/error_private.h b/lib/common/error_private.h index 0156010c7..06233aaa8 100644 --- a/lib/common/error_private.h +++ b/lib/common/error_private.h @@ -13,11 +13,6 @@ #ifndef ERROR_H_MODULE #define ERROR_H_MODULE -#if defined (__cplusplus) -extern "C" { -#endif - - /* **************************************** * Dependencies ******************************************/ @@ -26,6 +21,9 @@ extern "C" { #include "debug.h" #include "zstd_deps.h" /* size_t */ +#if defined (__cplusplus) +extern "C" { +#endif /* **************************************** * Compiler-specific diff --git a/lib/common/fse.h b/lib/common/fse.h index 2ae128e60..4c41b06ef 100644 --- a/lib/common/fse.h +++ b/lib/common/fse.h @@ -11,11 +11,6 @@ * in the COPYING file in the root directory of this source tree). * You may select, at your option, one of the above-listed licenses. ****************************************************************** */ - -#if defined (__cplusplus) -extern "C" { -#endif - #ifndef FSE_H #define FSE_H @@ -25,6 +20,14 @@ extern "C" { ******************************************/ #include "zstd_deps.h" /* size_t, ptrdiff_t */ +#if defined(FSE_STATIC_LINKING_ONLY) && !defined(FSE_H_FSE_STATIC_LINKING_ONLY) +#define FSE_H_FSE_STATIC_LINKING_ONLY +#include "bitstream.h" +#endif + +#if defined (__cplusplus) +extern "C" { +#endif /*-***************************************** * FSE_PUBLIC_API : control library symbols visibility @@ -233,9 +236,6 @@ If there is an error, the function will return an error code, which can be teste #if defined(FSE_STATIC_LINKING_ONLY) && !defined(FSE_H_FSE_STATIC_LINKING_ONLY) #define FSE_H_FSE_STATIC_LINKING_ONLY -/* *** Dependency *** */ -#include "bitstream.h" - /* ***************************************** * Static allocation diff --git a/lib/common/huf.h b/lib/common/huf.h index 99bf85d6f..bfcec4a81 100644 --- a/lib/common/huf.h +++ b/lib/common/huf.h @@ -12,10 +12,6 @@ * You may select, at your option, one of the above-listed licenses. ****************************************************************** */ -#if defined (__cplusplus) -extern "C" { -#endif - #ifndef HUF_H_298734234 #define HUF_H_298734234 @@ -25,6 +21,9 @@ extern "C" { #define FSE_STATIC_LINKING_ONLY #include "fse.h" +#if defined (__cplusplus) +extern "C" { +#endif /* *** Tool functions *** */ #define HUF_BLOCKSIZE_MAX (128 * 1024) /**< maximum input size for a single block compressed with HUF_compress */ diff --git a/lib/common/mem.h b/lib/common/mem.h index a02141c9d..1b0a946ad 100644 --- a/lib/common/mem.h +++ b/lib/common/mem.h @@ -11,10 +11,6 @@ #ifndef MEM_H_MODULE #define MEM_H_MODULE -#if defined (__cplusplus) -extern "C" { -#endif - /*-**************************************** * Dependencies ******************************************/ @@ -77,6 +73,10 @@ extern "C" { #endif +#if defined (__cplusplus) +extern "C" { +#endif + /*-************************************************************** * Memory I/O API *****************************************************************/ diff --git a/lib/common/pool.h b/lib/common/pool.h index cca4de73a..d34082dc1 100644 --- a/lib/common/pool.h +++ b/lib/common/pool.h @@ -11,15 +11,15 @@ #ifndef POOL_H #define POOL_H -#if defined (__cplusplus) -extern "C" { -#endif - #include "zstd_deps.h" #define ZSTD_STATIC_LINKING_ONLY /* ZSTD_customMem */ #include "../zstd.h" +#if defined (__cplusplus) +extern "C" { +#endif + typedef struct POOL_ctx_s POOL_ctx; /*! POOL_create() : diff --git a/lib/common/threading.h b/lib/common/threading.h index fb5c1c878..25448548d 100644 --- a/lib/common/threading.h +++ b/lib/common/threading.h @@ -16,10 +16,6 @@ #include "debug.h" -#if defined (__cplusplus) -extern "C" { -#endif - #if defined(ZSTD_MULTITHREAD) && defined(_WIN32) /** @@ -60,6 +56,11 @@ extern "C" { #define ZSTD_pthread_cond_signal(a) WakeConditionVariable((a)) #define ZSTD_pthread_cond_broadcast(a) WakeAllConditionVariable((a)) + +#if defined (__cplusplus) +extern "C" { +#endif + /* ZSTD_pthread_create() and ZSTD_pthread_join() */ typedef HANDLE ZSTD_pthread_t; @@ -73,10 +74,19 @@ int ZSTD_pthread_join(ZSTD_pthread_t thread); */ +#if defined (__cplusplus) +} +#endif + #elif defined(ZSTD_MULTITHREAD) /* posix assumed ; need a better detection method */ /* === POSIX Systems === */ # include + +#if defined (__cplusplus) +extern "C" { +#endif + #if DEBUGLEVEL < 1 #define ZSTD_pthread_mutex_t pthread_mutex_t @@ -123,9 +133,18 @@ int ZSTD_pthread_cond_destroy(ZSTD_pthread_cond_t* cond); #endif +#if defined (__cplusplus) +} +#endif + #else /* ZSTD_MULTITHREAD not defined */ /* No multithreading support */ + +#if defined (__cplusplus) +extern "C" { +#endif + typedef int ZSTD_pthread_mutex_t; #define ZSTD_pthread_mutex_init(a, b) ((void)(a), (void)(b), 0) #define ZSTD_pthread_mutex_destroy(a) ((void)(a)) diff --git a/lib/common/zstd_trace.h b/lib/common/zstd_trace.h index 173d63fb1..b9187079c 100644 --- a/lib/common/zstd_trace.h +++ b/lib/common/zstd_trace.h @@ -11,12 +11,12 @@ #ifndef ZSTD_TRACE_H #define ZSTD_TRACE_H +#include + #if defined (__cplusplus) extern "C" { #endif -#include - /* weak symbol support * For now, enable conservatively: * - Only GNUC diff --git a/lib/compress/zstd_double_fast.h b/lib/compress/zstd_double_fast.h index ce6ed8c97..ae66f3142 100644 --- a/lib/compress/zstd_double_fast.h +++ b/lib/compress/zstd_double_fast.h @@ -11,13 +11,13 @@ #ifndef ZSTD_DOUBLE_FAST_H #define ZSTD_DOUBLE_FAST_H +#include "../common/mem.h" /* U32 */ +#include "zstd_compress_internal.h" /* ZSTD_CCtx, size_t */ + #if defined (__cplusplus) extern "C" { #endif -#include "../common/mem.h" /* U32 */ -#include "zstd_compress_internal.h" /* ZSTD_CCtx, size_t */ - #ifndef ZSTD_EXCLUDE_DFAST_BLOCK_COMPRESSOR void ZSTD_fillDoubleHashTable(ZSTD_matchState_t* ms, diff --git a/lib/compress/zstd_fast.h b/lib/compress/zstd_fast.h index 9e4236b47..f92cf35b9 100644 --- a/lib/compress/zstd_fast.h +++ b/lib/compress/zstd_fast.h @@ -11,13 +11,13 @@ #ifndef ZSTD_FAST_H #define ZSTD_FAST_H +#include "../common/mem.h" /* U32 */ +#include "zstd_compress_internal.h" + #if defined (__cplusplus) extern "C" { #endif -#include "../common/mem.h" /* U32 */ -#include "zstd_compress_internal.h" - void ZSTD_fillHashTable(ZSTD_matchState_t* ms, void const* end, ZSTD_dictTableLoadMethod_e dtlm, ZSTD_tableFillPurpose_e tfp); diff --git a/lib/compress/zstd_lazy.h b/lib/compress/zstd_lazy.h index 3635813bd..bec17b124 100644 --- a/lib/compress/zstd_lazy.h +++ b/lib/compress/zstd_lazy.h @@ -11,12 +11,12 @@ #ifndef ZSTD_LAZY_H #define ZSTD_LAZY_H +#include "zstd_compress_internal.h" + #if defined (__cplusplus) extern "C" { #endif -#include "zstd_compress_internal.h" - /** * Dedicated Dictionary Search Structure bucket log. In the * ZSTD_dedicatedDictSearch mode, the hashTable has diff --git a/lib/compress/zstd_ldm.h b/lib/compress/zstd_ldm.h index f147021d2..847c2befb 100644 --- a/lib/compress/zstd_ldm.h +++ b/lib/compress/zstd_ldm.h @@ -11,13 +11,13 @@ #ifndef ZSTD_LDM_H #define ZSTD_LDM_H +#include "zstd_compress_internal.h" /* ldmParams_t, U32 */ +#include "../zstd.h" /* ZSTD_CCtx, size_t */ + #if defined (__cplusplus) extern "C" { #endif -#include "zstd_compress_internal.h" /* ldmParams_t, U32 */ -#include "../zstd.h" /* ZSTD_CCtx, size_t */ - /*-************************************* * Long distance matching ***************************************/ diff --git a/lib/compress/zstd_opt.h b/lib/compress/zstd_opt.h index d4e711315..7ce6fdae7 100644 --- a/lib/compress/zstd_opt.h +++ b/lib/compress/zstd_opt.h @@ -11,12 +11,12 @@ #ifndef ZSTD_OPT_H #define ZSTD_OPT_H +#include "zstd_compress_internal.h" + #if defined (__cplusplus) extern "C" { #endif -#include "zstd_compress_internal.h" - #if !defined(ZSTD_EXCLUDE_BTLAZY2_BLOCK_COMPRESSOR) \ || !defined(ZSTD_EXCLUDE_BTOPT_BLOCK_COMPRESSOR) \ || !defined(ZSTD_EXCLUDE_BTULTRA_BLOCK_COMPRESSOR) diff --git a/lib/compress/zstdmt_compress.h b/lib/compress/zstdmt_compress.h index ed4dc0e99..9a58b5ad3 100644 --- a/lib/compress/zstdmt_compress.h +++ b/lib/compress/zstdmt_compress.h @@ -11,6 +11,11 @@ #ifndef ZSTDMT_COMPRESS_H #define ZSTDMT_COMPRESS_H +/* === Dependencies === */ +#include "../common/zstd_deps.h" /* size_t */ +#define ZSTD_STATIC_LINKING_ONLY /* ZSTD_parameters */ +#include "../zstd.h" /* ZSTD_inBuffer, ZSTD_outBuffer, ZSTDLIB_API */ + #if defined (__cplusplus) extern "C" { #endif @@ -25,12 +30,6 @@ * otherwise ZSTDMT_createCCtx*() will fail. */ -/* === Dependencies === */ -#include "../common/zstd_deps.h" /* size_t */ -#define ZSTD_STATIC_LINKING_ONLY /* ZSTD_parameters */ -#include "../zstd.h" /* ZSTD_inBuffer, ZSTD_outBuffer, ZSTDLIB_API */ - - /* === Constants === */ #ifndef ZSTDMT_NBWORKERS_MAX /* a different value can be selected at compile time */ # define ZSTDMT_NBWORKERS_MAX ((sizeof(void*)==4) /*32-bit*/ ? 64 : 256) diff --git a/lib/zdict.h b/lib/zdict.h index bcccf750e..340a9a24e 100644 --- a/lib/zdict.h +++ b/lib/zdict.h @@ -8,16 +8,16 @@ * You may select, at your option, one of the above-listed licenses. */ -#if defined (__cplusplus) -extern "C" { -#endif - #ifndef ZSTD_ZDICT_H #define ZSTD_ZDICT_H + /*====== Dependencies ======*/ #include /* size_t */ +#if defined (__cplusplus) +extern "C" { +#endif /* ===== ZDICTLIB_API : control library symbols visibility ===== */ #ifndef ZDICTLIB_VISIBLE diff --git a/lib/zstd.h b/lib/zstd.h index a78b6db45..7571f8069 100644 --- a/lib/zstd.h +++ b/lib/zstd.h @@ -7,16 +7,22 @@ * in the COPYING file in the root directory of this source tree). * You may select, at your option, one of the above-listed licenses. */ -#if defined (__cplusplus) -extern "C" { -#endif #ifndef ZSTD_H_235446 #define ZSTD_H_235446 + /* ====== Dependencies ======*/ #include /* size_t */ +#include "zstd_errors.h" /* list of errors */ +#if defined(ZSTD_STATIC_LINKING_ONLY) && !defined(ZSTD_H_ZSTD_STATIC_LINKING_ONLY) +#include /* INT_MAX */ +#endif /* ZSTD_STATIC_LINKING_ONLY */ + +#if defined (__cplusplus) +extern "C" { +#endif /* ===== ZSTDLIB_API : control library symbols visibility ===== */ #ifndef ZSTDLIB_VISIBLE @@ -240,7 +246,6 @@ ZSTDLIB_API size_t ZSTD_compressBound(size_t srcSize); /*!< maximum compressed s /*====== Error helper functions ======*/ -#include "zstd_errors.h" /* list of errors */ /* ZSTD_isError() : * Most ZSTD_* functions returning a size_t value can be tested for error, * using ZSTD_isError(). @@ -1215,8 +1220,6 @@ ZSTDLIB_API size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict); #if defined(ZSTD_STATIC_LINKING_ONLY) && !defined(ZSTD_H_ZSTD_STATIC_LINKING_ONLY) #define ZSTD_H_ZSTD_STATIC_LINKING_ONLY -#include /* INT_MAX */ - /* This can be overridden externally to hide static symbols. */ #ifndef ZSTDLIB_STATIC_API # if defined(ZSTD_DLL_EXPORT) && (ZSTD_DLL_EXPORT==1) diff --git a/programs/benchfn.h b/programs/benchfn.h index 1bd93d135..3ba3a4f55 100644 --- a/programs/benchfn.h +++ b/programs/benchfn.h @@ -15,10 +15,6 @@ * or detecting and returning an error */ -#if defined (__cplusplus) -extern "C" { -#endif - #ifndef BENCH_FN_H_23876 #define BENCH_FN_H_23876 @@ -26,6 +22,10 @@ extern "C" { #include /* size_t */ +#if defined (__cplusplus) +extern "C" { +#endif + /* ==== Benchmark any function, iterated on a set of blocks ==== */ /* BMK_runTime_t: valid result return type */ diff --git a/programs/benchzstd.h b/programs/benchzstd.h index 6388d4d58..7ea018b12 100644 --- a/programs/benchzstd.h +++ b/programs/benchzstd.h @@ -14,10 +14,6 @@ * and display progress result and final summary */ -#if defined (__cplusplus) -extern "C" { -#endif - #ifndef BENCH_ZSTD_H_3242387 #define BENCH_ZSTD_H_3242387 @@ -27,6 +23,10 @@ extern "C" { #include "../lib/zstd.h" /* ZSTD_compressionParameters */ +#if defined (__cplusplus) +extern "C" { +#endif + /* === Constants === */ #define MB_UNIT 1000000 diff --git a/programs/fileio_asyncio.h b/programs/fileio_asyncio.h index feb25a3f9..1c30a73da 100644 --- a/programs/fileio_asyncio.h +++ b/programs/fileio_asyncio.h @@ -22,10 +22,6 @@ #ifndef ZSTD_FILEIO_ASYNCIO_H #define ZSTD_FILEIO_ASYNCIO_H -#if defined (__cplusplus) -extern "C" { -#endif - #include "../lib/common/mem.h" /* U32, U64 */ #include "fileio_types.h" #include "platform.h" @@ -35,6 +31,10 @@ extern "C" { #define MAX_IO_JOBS (10) +#if defined (__cplusplus) +extern "C" { +#endif + typedef struct { /* These struct fields should be set only on creation and not changed afterwards */ POOL_ctx* threadPool; diff --git a/programs/fileio_common.h b/programs/fileio_common.h index 7a014ee4b..87f99cda9 100644 --- a/programs/fileio_common.h +++ b/programs/fileio_common.h @@ -11,15 +11,22 @@ #ifndef ZSTD_FILEIO_COMMON_H #define ZSTD_FILEIO_COMMON_H -#if defined (__cplusplus) -extern "C" { -#endif - #include "../lib/common/mem.h" /* U32, U64 */ #include "fileio_types.h" #include "platform.h" #include "timefn.h" /* UTIL_getTime, UTIL_clockSpanMicro */ +#if !(defined(_MSC_VER) && _MSC_VER >= 1400) \ + && !(!defined(__64BIT__) && (PLATFORM_POSIX_VERSION >= 200112L)) \ + && !(defined(__MINGW32__) && !defined(__STRICT_ANSI__) && !defined(__NO_MINGW_LFS) && defined(__MSVCRT__)) \ + && (defined(_WIN32) && !defined(__DJGPP__)) +# include +#endif + +#if defined (__cplusplus) +extern "C" { +#endif + /*-************************************* * Macros ***************************************/ @@ -89,7 +96,6 @@ extern UTIL_time_t g_displayClock; # define LONG_SEEK fseeko64 # define LONG_TELL ftello64 #elif defined(_WIN32) && !defined(__DJGPP__) -# include static int LONG_SEEK(FILE* file, __int64 offset, int origin) { LARGE_INTEGER off; DWORD method; diff --git a/programs/platform.h b/programs/platform.h index 4d2b9490e..05a26a564 100644 --- a/programs/platform.h +++ b/programs/platform.h @@ -11,12 +11,6 @@ #ifndef PLATFORM_H_MODULE #define PLATFORM_H_MODULE -#if defined (__cplusplus) -extern "C" { -#endif - - - /* ************************************** * Compiler Options ****************************************/ @@ -144,10 +138,20 @@ extern "C" { # include /* _isatty */ # include /* DeviceIoControl, HANDLE, FSCTL_SET_SPARSE */ # include /* FILE */ + +#if defined (__cplusplus) +extern "C" { +#endif + static __inline int IS_CONSOLE(FILE* stdStream) { DWORD dummy; return _isatty(_fileno(stdStream)) && GetConsoleMode((HANDLE)_get_osfhandle(_fileno(stdStream)), &dummy); } + +#if defined (__cplusplus) +} +#endif + #else # define IS_CONSOLE(stdStream) 0 #endif @@ -210,9 +214,4 @@ static __inline int IS_CONSOLE(FILE* stdStream) { # endif #endif - -#if defined (__cplusplus) -} -#endif - #endif /* PLATFORM_H_MODULE */ diff --git a/programs/timefn.h b/programs/timefn.h index b814ff8d8..dc7463be3 100644 --- a/programs/timefn.h +++ b/programs/timefn.h @@ -11,12 +11,6 @@ #ifndef TIME_FN_H_MODULE_287987 #define TIME_FN_H_MODULE_287987 -#if defined (__cplusplus) -extern "C" { -#endif - - - /*-**************************************** * Types ******************************************/ @@ -32,6 +26,11 @@ extern "C" { typedef unsigned long long PTime; /* does not support compilers without long long support */ #endif + +#if defined (__cplusplus) +extern "C" { +#endif + /* UTIL_time_t contains a nanosecond time counter. * The absolute value is not meaningful. * It's only valid to compute the difference between 2 measurements. */ diff --git a/programs/util.c b/programs/util.c index 7f65f9373..065a35855 100644 --- a/programs/util.c +++ b/programs/util.c @@ -8,11 +8,6 @@ * You may select, at your option, one of the above-listed licenses. */ -#if defined (__cplusplus) -extern "C" { -#endif - - /*-**************************************** * Dependencies ******************************************/ @@ -1646,7 +1641,3 @@ int UTIL_countLogicalCores(void) { return UTIL_countCores(1); } - -#if defined (__cplusplus) -} -#endif diff --git a/programs/util.h b/programs/util.h index ec8139684..5868f5eae 100644 --- a/programs/util.h +++ b/programs/util.h @@ -20,6 +20,9 @@ #include /* stat, utime */ #include /* stat, chmod */ #include "../lib/common/mem.h" /* U64 */ +#if not (defined(_MSC_VER) || defined(__MINGW32__) || defined (__MSVCRT__)) +#include +#endif /*-************************************************************ * Fix fseek()'s 2GiB barrier with MSVC, macOS, *BSD, MinGW @@ -116,7 +119,6 @@ int UTIL_requireUserConfirmation(const char* prompt, const char* abortMsg, const #define STRDUP(s) _strdup(s) #else #define PATH_SEP '/' -#include #define STRDUP(s) strdup(s) #endif diff --git a/zlibWrapper/zstd_zlibwrapper.h b/zlibWrapper/zstd_zlibwrapper.h index 230bf8411..dae6787d3 100644 --- a/zlibWrapper/zstd_zlibwrapper.h +++ b/zlibWrapper/zstd_zlibwrapper.h @@ -11,11 +11,6 @@ #ifndef ZSTD_ZLIBWRAPPER_H #define ZSTD_ZLIBWRAPPER_H -#if defined (__cplusplus) -extern "C" { -#endif - - #define ZLIB_CONST #define Z_PREFIX #define ZLIB_INTERNAL /* disables gz*64 functions but fixes zlib 1.2.4 with Z_PREFIX */ @@ -29,6 +24,11 @@ extern "C" { #define _Z_OF OF #endif + +#if defined (__cplusplus) +extern "C" { +#endif + /* returns a string with version of zstd library */ const char * zstdVersion(void);