From 3ebebfccd8f33e55899905f462682a0d9d4736be Mon Sep 17 00:00:00 2001 From: Sameet Agarwal Date: Wed, 11 Mar 2015 18:00:57 -0700 Subject: [PATCH] Prevent xxhash symbols from polluting global namespace Summary: The functions and global symbols in xxhash.h and xxhash.cc were not in any namespace. This caused issues when rocksdb library was being used along with other uses of libraries with the same name Test Plan: unit tests Reviewers: CC: Task ID: # Blame Rev: --- util/xxhash.cc | 3 +++ util/xxhash.h | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/util/xxhash.cc b/util/xxhash.cc index 6dfd4b283..3204cbb0f 100644 --- a/util/xxhash.cc +++ b/util/xxhash.cc @@ -92,6 +92,7 @@ FORCE_INLINE void XXH_free (void* p) { free(p); } FORCE_INLINE void* XXH_memcpy(void* dest, const void* src, size_t size) { return memcpy(dest,src,size); } +namespace rocksdb { //************************************** // Basic Types //************************************** @@ -473,3 +474,5 @@ U32 XXH32_digest (void* state_in) return h32; } + +} // namespace rocksdb diff --git a/util/xxhash.h b/util/xxhash.h index ceff06677..3343e3488 100644 --- a/util/xxhash.h +++ b/util/xxhash.h @@ -60,7 +60,7 @@ It depends on successfully passing SMHasher test set. #pragma once #if defined (__cplusplus) -extern "C" { +namespace rocksdb { #endif @@ -160,5 +160,5 @@ To free memory context, use XXH32_digest(), or free(). #if defined (__cplusplus) -} +} // namespace rocksdb #endif