Fixed clash when projects are already using xxHash
Undefing XXH_* macros allows the `.c` to build standalone without clashes. Removing `xxhash.c` and only including the header is the correct usage (according to `XXH_PRIVATE_API`).dev
parent
4e6027f8ca
commit
3eaa525138
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* \file zstd.c
|
||||
* Single-file Zstandard library.
|
||||
*
|
||||
*
|
||||
* Generate using:
|
||||
* \code
|
||||
* combine.sh -r ../../lib -r ../../lib/common -r ../../lib/compress -r ../../lib/decompress -k zstd.h -o zstd.c zstd-in.c
|
||||
|
@ -18,19 +18,25 @@
|
|||
*/
|
||||
/*
|
||||
* Settings to bake for the single library file.
|
||||
*
|
||||
*
|
||||
* Note: It's important that none of these affects 'zstd.h' (only the
|
||||
* implementation files we're amalgamating).
|
||||
*
|
||||
*
|
||||
* Note: MEM_MODULE stops xxhash redefining BYTE, U16, etc., which are also
|
||||
* defined in mem.h (breaking C99 compatibility).
|
||||
*
|
||||
*
|
||||
* Note: the undefs for xxHash allow Zstd's implementation to coinside with with
|
||||
* standalone xxHash usage (with global defines).
|
||||
*
|
||||
* Note: multithreading is enabled for all platforms apart from Emscripten.
|
||||
*/
|
||||
#define DEBUGLEVEL 0
|
||||
#define MEM_MODULE
|
||||
#undef XXH_NAMESPACE
|
||||
#define XXH_NAMESPACE ZSTD_
|
||||
#undef XXH_PRIVATE_API
|
||||
#define XXH_PRIVATE_API
|
||||
#undef XXH_INLINE_ALL
|
||||
#define XXH_INLINE_ALL
|
||||
#define ZSTD_LEGACY_SUPPORT 0
|
||||
#define ZSTD_LIB_DICTBUILDER 0
|
||||
|
@ -40,17 +46,16 @@
|
|||
#define ZSTD_MULTITHREAD
|
||||
#endif
|
||||
|
||||
/* common */
|
||||
/* lib/common */
|
||||
#include "debug.c"
|
||||
#include "entropy_common.c"
|
||||
#include "error_private.c"
|
||||
#include "fse_decompress.c"
|
||||
#include "threading.c"
|
||||
#include "pool.c"
|
||||
#include "xxhash.c"
|
||||
#include "zstd_common.c"
|
||||
|
||||
/* compress */
|
||||
/* lib/compress */
|
||||
#include "fse_compress.c"
|
||||
#include "hist.c"
|
||||
#include "huf_compress.c"
|
||||
|
@ -67,7 +72,7 @@
|
|||
#include "zstdmt_compress.c"
|
||||
#endif
|
||||
|
||||
/* decompress */
|
||||
/* lib/decompress */
|
||||
#include "huf_decompress.c"
|
||||
#include "zstd_ddict.c"
|
||||
#include "zstd_decompress.c"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* \file zstddeclib.c
|
||||
* Single-file Zstandard decompressor.
|
||||
*
|
||||
*
|
||||
* Generate using:
|
||||
* \code
|
||||
* combine.sh -r ../../lib -r ../../lib/common -r ../../lib/decompress -o zstddeclib.c zstddeclib-in.c
|
||||
|
@ -18,17 +18,23 @@
|
|||
*/
|
||||
/*
|
||||
* Settings to bake for the standalone decompressor.
|
||||
*
|
||||
*
|
||||
* Note: It's important that none of these affects 'zstd.h' (only the
|
||||
* implementation files we're amalgamating).
|
||||
*
|
||||
*
|
||||
* Note: MEM_MODULE stops xxhash redefining BYTE, U16, etc., which are also
|
||||
* defined in mem.h (breaking C99 compatibility).
|
||||
*
|
||||
* Note: the undefs for xxHash allow Zstd's implementation to coinside with with
|
||||
* standalone xxHash usage (with global defines).
|
||||
*/
|
||||
#define DEBUGLEVEL 0
|
||||
#define MEM_MODULE
|
||||
#undef XXH_NAMESPACE
|
||||
#define XXH_NAMESPACE ZSTD_
|
||||
#undef XXH_PRIVATE_API
|
||||
#define XXH_PRIVATE_API
|
||||
#undef XXH_INLINE_ALL
|
||||
#define XXH_INLINE_ALL
|
||||
#define ZSTD_LEGACY_SUPPORT 0
|
||||
#define ZSTD_LIB_COMPRESSION 0
|
||||
|
@ -36,15 +42,14 @@
|
|||
#define ZSTD_NOBENCH
|
||||
#define ZSTD_STRIP_ERROR_STRINGS
|
||||
|
||||
/* common */
|
||||
/* lib/common */
|
||||
#include "debug.c"
|
||||
#include "entropy_common.c"
|
||||
#include "error_private.c"
|
||||
#include "fse_decompress.c"
|
||||
#include "xxhash.c"
|
||||
#include "zstd_common.c"
|
||||
|
||||
/* decompress */
|
||||
/* lib/decompress */
|
||||
#include "huf_decompress.c"
|
||||
#include "zstd_ddict.c"
|
||||
#include "zstd_decompress.c"
|
||||
|
|
Loading…
Reference in New Issue