summaryrefslogtreecommitdiffstats
path: root/lib/xxhash.h
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 /lib/xxhash.h
parentc04df7e1b5fb1e4ffa796d2b3d2dea208f7116da (diff)
downloadlz4-192ee724a3478bb7d4aaebccbc1d18f9692fbb1a.zip
lz4-192ee724a3478bb7d4aaebccbc1d18f9692fbb1a.tar.gz
lz4-192ee724a3478bb7d4aaebccbc1d18f9692fbb1a.tar.bz2
Added namespace ability to xxhash
Diffstat (limited to 'lib/xxhash.h')
-rw-r--r--lib/xxhash.h33
1 files changed, 33 insertions, 0 deletions
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