Commit 72ee0787 by Russell Belfer

Isolate khash inlines from global namespace

khash.h was globally #define'ing "inline" which messes with
other files.  Let's keep it as "kh_inline".
parent b7158c53
...@@ -131,7 +131,9 @@ typedef unsigned long long khint64_t; ...@@ -131,7 +131,9 @@ typedef unsigned long long khint64_t;
#endif #endif
#ifdef _MSC_VER #ifdef _MSC_VER
#define inline __inline #define kh_inline __inline
#else
#define kh_inline inline
#endif #endif
typedef khint32_t khint_t; typedef khint32_t khint_t;
...@@ -345,7 +347,7 @@ static const double __ac_HASH_UPPER = 0.77; ...@@ -345,7 +347,7 @@ static const double __ac_HASH_UPPER = 0.77;
__KHASH_IMPL(name, SCOPE, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal) __KHASH_IMPL(name, SCOPE, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal)
#define KHASH_INIT(name, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal) \ #define KHASH_INIT(name, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal) \
KHASH_INIT2(name, static inline, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal) KHASH_INIT2(name, static kh_inline, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal)
/* --- BEGIN OF HASH FUNCTIONS --- */ /* --- BEGIN OF HASH FUNCTIONS --- */
...@@ -374,7 +376,7 @@ static const double __ac_HASH_UPPER = 0.77; ...@@ -374,7 +376,7 @@ static const double __ac_HASH_UPPER = 0.77;
@param s Pointer to a null terminated string @param s Pointer to a null terminated string
@return The hash value @return The hash value
*/ */
static inline khint_t __ac_X31_hash_string(const char *s) static kh_inline khint_t __ac_X31_hash_string(const char *s)
{ {
khint_t h = (khint_t)*s; khint_t h = (khint_t)*s;
if (h) for (++s ; *s; ++s) h = (h << 5) - h + (khint_t)*s; if (h) for (++s ; *s; ++s) h = (h << 5) - h + (khint_t)*s;
...@@ -391,7 +393,7 @@ static inline khint_t __ac_X31_hash_string(const char *s) ...@@ -391,7 +393,7 @@ static inline khint_t __ac_X31_hash_string(const char *s)
*/ */
#define kh_str_hash_equal(a, b) (strcmp(a, b) == 0) #define kh_str_hash_equal(a, b) (strcmp(a, b) == 0)
static inline khint_t __ac_Wang_hash(khint_t key) static kh_inline khint_t __ac_Wang_hash(khint_t key)
{ {
key += ~(key << 15); key += ~(key << 15);
key ^= (key >> 10); key ^= (key >> 10);
......
...@@ -31,7 +31,7 @@ static git_cvar_map _sm_ignore_map[] = { ...@@ -31,7 +31,7 @@ static git_cvar_map _sm_ignore_map[] = {
{GIT_CVAR_STRING, "none", GIT_SUBMODULE_IGNORE_NONE} {GIT_CVAR_STRING, "none", GIT_SUBMODULE_IGNORE_NONE}
}; };
static inline khint_t str_hash_no_trailing_slash(const char *s) static kh_inline khint_t str_hash_no_trailing_slash(const char *s)
{ {
khint_t h; khint_t h;
...@@ -42,7 +42,7 @@ static inline khint_t str_hash_no_trailing_slash(const char *s) ...@@ -42,7 +42,7 @@ static inline khint_t str_hash_no_trailing_slash(const char *s)
return h; return h;
} }
static inline int str_equal_no_trailing_slash(const char *a, const char *b) static kh_inline int str_equal_no_trailing_slash(const char *a, const char *b)
{ {
size_t alen = a ? strlen(a) : 0; size_t alen = a ? strlen(a) : 0;
size_t blen = b ? strlen(b) : 0; size_t blen = b ? strlen(b) : 0;
...@@ -55,7 +55,7 @@ static inline int str_equal_no_trailing_slash(const char *a, const char *b) ...@@ -55,7 +55,7 @@ static inline int str_equal_no_trailing_slash(const char *a, const char *b)
return (alen == blen && strncmp(a, b, alen) == 0); return (alen == blen && strncmp(a, b, alen) == 0);
} }
__KHASH_IMPL(str, static inline, const char *, void *, 1, str_hash_no_trailing_slash, str_equal_no_trailing_slash); __KHASH_IMPL(str, static kh_inline, const char *, void *, 1, str_hash_no_trailing_slash, str_equal_no_trailing_slash);
static git_submodule *submodule_alloc(const char *name) static git_submodule *submodule_alloc(const char *name)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment