summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Collet <yann.collet.73@gmail.com>2015-06-27 20:43:28 (GMT)
committerYann Collet <yann.collet.73@gmail.com>2015-06-27 20:43:28 (GMT)
commit192ee724a3478bb7d4aaebccbc1d18f9692fbb1a (patch)
treef3d83d2e26ae09f568cea8113ffa0be152f097d1
parentc04df7e1b5fb1e4ffa796d2b3d2dea208f7116da (diff)
downloadlz4-192ee724a3478bb7d4aaebccbc1d18f9692fbb1a.zip
lz4-192ee724a3478bb7d4aaebccbc1d18f9692fbb1a.tar.gz
lz4-192ee724a3478bb7d4aaebccbc1d18f9692fbb1a.tar.bz2
Added namespace ability to xxhash
-rw-r--r--lib/Makefile2
-rw-r--r--lib/lz4.h2
-rw-r--r--lib/xxhash.h33
3 files changed, 35 insertions, 2 deletions
diff --git a/lib/Makefile b/lib/Makefile
index 05260ca..02ddd3b 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -40,7 +40,7 @@ LIBVER=$(LIBVER_MAJOR).$(LIBVER_MINOR).$(LIBVER_PATCH)
DESTDIR?=
PREFIX ?= /usr/local
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
INCLUDEDIR=$(PREFIX)/include
diff --git a/lib/lz4.h b/lib/lz4.h
index 99c6ebb..3e74002 100644
--- a/lib/lz4.h
+++ b/lib/lz4.h
@@ -49,7 +49,7 @@ extern "C" {
**************************************/
#define LZ4_VERSION_MAJOR 1 /* for breaking interface changes */
#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)
int LZ4_versionNumber (void);
diff --git a/lib/xxhash.h b/lib/xxhash.h
index 0df5ac1..c60aa61 100644
--- a/lib/xxhash.h
+++ b/lib/xxhash.h
@@ -78,6 +78,39 @@ extern "C" {
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