Skip to content

Commit 9b39800

Browse files
committed
Rename kh_inline to klib_inline and use in kdq, klist
1 parent 2629253 commit 9b39800

File tree

3 files changed

+26
-10
lines changed

3 files changed

+26
-10
lines changed

kdq.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,14 @@
9393
__KDQ_TYPE(type) \
9494
__KDQ_IMPL(type, SCOPE)
9595

96+
#ifndef klib_inline
97+
#ifdef _MSC_VER
98+
#define klib_inline __inline
99+
#else
100+
#define klib_inline inline
101+
#endif
102+
#endif /* klib_inline */
103+
96104
#ifndef klib_unused
97105
#if (defined __clang__ && __clang_major__ >= 3) || (defined __GNUC__ && __GNUC__ >= 3)
98106
#define klib_unused __attribute__ ((__unused__))
@@ -101,7 +109,7 @@
101109
#endif
102110
#endif /* klib_unused */
103111

104-
#define KDQ_INIT(type) KDQ_INIT2(type, static inline klib_unused)
112+
#define KDQ_INIT(type) KDQ_INIT2(type, static klib_inline klib_unused)
105113

106114
#define KDQ_DECLARE(type) \
107115
__KDQ_TYPE(type) \

khash.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,13 @@ typedef unsigned long khint64_t;
143143
typedef unsigned long long khint64_t;
144144
#endif
145145

146-
#ifndef kh_inline
146+
#ifndef klib_inline
147147
#ifdef _MSC_VER
148-
#define kh_inline __inline
148+
#define klib_inline __inline
149149
#else
150-
#define kh_inline inline
150+
#define klib_inline inline
151151
#endif
152-
#endif /* kh_inline */
152+
#endif /* klib_inline */
153153

154154
#ifndef klib_unused
155155
#if (defined __clang__ && __clang_major__ >= 3) || (defined __GNUC__ && __GNUC__ >= 3)
@@ -363,7 +363,7 @@ static const double __ac_HASH_UPPER = 0.77;
363363
__KHASH_IMPL(name, SCOPE, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal)
364364

365365
#define KHASH_INIT(name, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal) \
366-
KHASH_INIT2(name, static kh_inline klib_unused, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal)
366+
KHASH_INIT2(name, static klib_inline klib_unused, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal)
367367

368368
/* --- BEGIN OF HASH FUNCTIONS --- */
369369

@@ -392,7 +392,7 @@ static const double __ac_HASH_UPPER = 0.77;
392392
@param s Pointer to a null terminated string
393393
@return The hash value
394394
*/
395-
static kh_inline khint_t __ac_X31_hash_string(const char *s)
395+
static klib_inline khint_t __ac_X31_hash_string(const char *s)
396396
{
397397
khint_t h = (khint_t)*s;
398398
if (h) for (++s ; *s; ++s) h = (h << 5) - h + (khint_t)*s;
@@ -409,7 +409,7 @@ static kh_inline khint_t __ac_X31_hash_string(const char *s)
409409
*/
410410
#define kh_str_hash_equal(a, b) (strcmp(a, b) == 0)
411411

412-
static kh_inline khint_t __ac_Wang_hash(khint_t key)
412+
static klib_inline khint_t __ac_Wang_hash(khint_t key)
413413
{
414414
key += ~(key << 15);
415415
key ^= (key >> 10);

klist.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@
2828

2929
#include <stdlib.h>
3030

31+
#ifndef klib_inline
32+
#ifdef _MSC_VER
33+
#define klib_inline __inline
34+
#else
35+
#define klib_inline inline
36+
#endif
37+
#endif /* klib_inline */
38+
3139
#ifndef klib_unused
3240
#if (defined __clang__ && __clang_major__ >= 3) || (defined __GNUC__ && __GNUC__ >= 3)
3341
#define klib_unused __attribute__ ((__unused__))
@@ -66,7 +74,7 @@
6674
}
6775

6876
#define KMEMPOOL_INIT(name, kmptype_t, kmpfree_f) \
69-
KMEMPOOL_INIT2(static inline klib_unused, name, kmptype_t, kmpfree_f)
77+
KMEMPOOL_INIT2(static klib_inline klib_unused, name, kmptype_t, kmpfree_f)
7078

7179
#define kmempool_t(name) kmp_##name##_t
7280
#define kmp_init(name) kmp_init_##name()
@@ -118,7 +126,7 @@
118126
}
119127

120128
#define KLIST_INIT(name, kltype_t, kmpfree_t) \
121-
KLIST_INIT2(static inline klib_unused, name, kltype_t, kmpfree_t)
129+
KLIST_INIT2(static klib_inline klib_unused, name, kltype_t, kmpfree_t)
122130

123131
#define kliter_t(name) kl1_##name
124132
#define klist_t(name) kl_##name##_t

0 commit comments

Comments
 (0)