mirror of
https://github.com/json-c/json-c.git
synced 2026-04-04 12:59:07 +08:00
Issue #359: Don't duplicate lh_get_hash, just omit the "inline" for VS2010.
This commit is contained in:
@@ -560,13 +560,6 @@ int lh_table_resize(struct lh_table *t, int new_size)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_MSC_VER) && (_MSC_VER < 1900)
|
|
||||||
unsigned long lh_get_hash(const struct lh_table *t, const void *k)
|
|
||||||
{
|
|
||||||
return t->hash_fn(k);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void lh_table_free(struct lh_table *t)
|
void lh_table_free(struct lh_table *t)
|
||||||
{
|
{
|
||||||
struct lh_entry *c;
|
struct lh_entry *c;
|
||||||
|
|||||||
21
linkhash.h
21
linkhash.h
@@ -322,6 +322,13 @@ void lh_abort(const char *msg, ...);
|
|||||||
int lh_table_resize(struct lh_table *t, int new_size);
|
int lh_table_resize(struct lh_table *t, int new_size);
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(_MSC_VER) || (_MSC_VER > 1800)
|
||||||
|
/* VS2010 can't handle inline funcs, so skip it there */
|
||||||
|
#define _LH_INLINE inline
|
||||||
|
#else
|
||||||
|
#define _LH_INLINE
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate the hash of a key for a given table.
|
* Calculate the hash of a key for a given table.
|
||||||
* This is an exension to support functions that need to calculate
|
* This is an exension to support functions that need to calculate
|
||||||
@@ -332,19 +339,17 @@ int lh_table_resize(struct lh_table *t, int new_size);
|
|||||||
* @param k a pointer to the key to lookup
|
* @param k a pointer to the key to lookup
|
||||||
* @return the key's hash
|
* @return the key's hash
|
||||||
*/
|
*/
|
||||||
#if !defined(_MSC_VER) || (_MSC_VER > 1800)
|
static _LH_INLINE unsigned long lh_get_hash(const struct lh_table *t, const void *k)
|
||||||
static inline unsigned long lh_get_hash(const struct lh_table *t, const void *k)
|
{
|
||||||
{
|
return t->hash_fn(k);
|
||||||
return t->hash_fn(k);
|
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
unsigned long lh_get_hash(const struct lh_table *t, const void *k);
|
#undef _LH_INLINE
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Don't use this outside of linkhash.h: */
|
/* Don't use this outside of linkhash.h: */
|
||||||
#ifdef __UNCONST
|
#ifdef __UNCONST
|
||||||
#define _LH_UNCONST(a) __UNCONST(a)
|
#define _LH_UNCONST(a) __UNCONST(a)
|
||||||
#else
|
#else
|
||||||
#define _LH_UNCONST(a) ((void *)(uintptr_t)(const void *)(a))
|
#define _LH_UNCONST(a) ((void *)(uintptr_t)(const void *)(a))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user