Added namespace ability to xxhash
This commit is contained in:
parent
c04df7e1b5
commit
192ee724a3
@ -40,7 +40,7 @@ LIBVER=$(LIBVER_MAJOR).$(LIBVER_MINOR).$(LIBVER_PATCH)
|
|||||||
DESTDIR?=
|
DESTDIR?=
|
||||||
PREFIX ?= /usr/local
|
PREFIX ?= /usr/local
|
||||||
CFLAGS ?= -O3
|
CFLAGS ?= -O3
|
||||||
CFLAGS += -I. -std=c99 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Wcast-qual -Wstrict-prototypes -pedantic
|
CFLAGS += -I. -std=c99 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Wcast-qual -Wstrict-prototypes -pedantic -DXXH_NAMESPACE=LZ4_
|
||||||
|
|
||||||
LIBDIR?= $(PREFIX)/lib
|
LIBDIR?= $(PREFIX)/lib
|
||||||
INCLUDEDIR=$(PREFIX)/include
|
INCLUDEDIR=$(PREFIX)/include
|
||||||
|
@ -49,7 +49,7 @@ extern "C" {
|
|||||||
**************************************/
|
**************************************/
|
||||||
#define LZ4_VERSION_MAJOR 1 /* for breaking interface changes */
|
#define LZ4_VERSION_MAJOR 1 /* for breaking interface changes */
|
||||||
#define LZ4_VERSION_MINOR 7 /* for new (non-breaking) interface capabilities */
|
#define LZ4_VERSION_MINOR 7 /* for new (non-breaking) interface capabilities */
|
||||||
#define LZ4_VERSION_RELEASE 0 /* for tweaks, bug-fixes, or development */
|
#define LZ4_VERSION_RELEASE 1 /* for tweaks, bug-fixes, or development */
|
||||||
#define LZ4_VERSION_NUMBER (LZ4_VERSION_MAJOR *100*100 + LZ4_VERSION_MINOR *100 + LZ4_VERSION_RELEASE)
|
#define LZ4_VERSION_NUMBER (LZ4_VERSION_MAJOR *100*100 + LZ4_VERSION_MINOR *100 + LZ4_VERSION_RELEASE)
|
||||||
int LZ4_versionNumber (void);
|
int LZ4_versionNumber (void);
|
||||||
|
|
||||||
|
33
lib/xxhash.h
33
lib/xxhash.h
@ -78,6 +78,39 @@ extern "C" {
|
|||||||
typedef enum { XXH_OK=0, XXH_ERROR } XXH_errorcode;
|
typedef enum { XXH_OK=0, XXH_ERROR } XXH_errorcode;
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************
|
||||||
|
* Namespace Emulation
|
||||||
|
*****************************/
|
||||||
|
/* Motivations :
|
||||||
|
|
||||||
|
If you need to include xxHash into your library,
|
||||||
|
but wish to avoid xxHash symbols to be present on your library interface
|
||||||
|
in an effort to avoid potential name collision if another library also includes xxHash,
|
||||||
|
|
||||||
|
you can use XXH_NAMESPACE, which will automatically prefix any symbol from xxHash
|
||||||
|
with the value of XXH_NAMESPACE (so avoid to keep it NULL, and avoid numeric values).
|
||||||
|
|
||||||
|
Note that no change is required within the calling program :
|
||||||
|
it can still call xxHash functions using their regular name.
|
||||||
|
They will be automatically translated by this header.
|
||||||
|
*/
|
||||||
|
#ifdef XXH_NAMESPACE
|
||||||
|
# define XXH_CAT(A,B) A##B
|
||||||
|
# define XXH_NAME2(A,B) XXH_CAT(A,B)
|
||||||
|
# define XXH32 XXH_NAME2(XXH_NAMESPACE, XXH32)
|
||||||
|
# define XXH64 XXH_NAME2(XXH_NAMESPACE, XXH64)
|
||||||
|
# define XXH32_createState XXH_NAME2(XXH_NAMESPACE, XXH32_createState)
|
||||||
|
# define XXH64_createState XXH_NAME2(XXH_NAMESPACE, XXH64_createState)
|
||||||
|
# define XXH32_freeState XXH_NAME2(XXH_NAMESPACE, XXH32_freeState)
|
||||||
|
# define XXH64_freeState XXH_NAME2(XXH_NAMESPACE, XXH64_freeState)
|
||||||
|
# define XXH32_reset XXH_NAME2(XXH_NAMESPACE, XXH32_reset)
|
||||||
|
# define XXH64_reset XXH_NAME2(XXH_NAMESPACE, XXH64_reset)
|
||||||
|
# define XXH32_update XXH_NAME2(XXH_NAMESPACE, XXH32_update)
|
||||||
|
# define XXH64_update XXH_NAME2(XXH_NAMESPACE, XXH64_update)
|
||||||
|
# define XXH32_digest XXH_NAME2(XXH_NAMESPACE, XXH32_digest)
|
||||||
|
# define XXH64_digest XXH_NAME2(XXH_NAMESPACE, XXH64_digest)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*****************************
|
/*****************************
|
||||||
* Simple Hash Functions
|
* Simple Hash Functions
|
||||||
|
Loading…
Reference in New Issue
Block a user