From e9f9f14f227838c2181eac62a8366018562af20f Mon Sep 17 00:00:00 2001 From: Haffon <20966113@qq.com> Date: Thu, 7 Sep 2017 10:28:26 +0800 Subject: [PATCH] if compile with vs2015, enable the "static inline" declare. --- linkhash.c | 2 ++ linkhash.h | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/linkhash.c b/linkhash.c index 73925b9..f68ff6f 100644 --- a/linkhash.c +++ b/linkhash.c @@ -560,10 +560,12 @@ int lh_table_resize(struct lh_table *t, int new_size) 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) { diff --git a/linkhash.h b/linkhash.h index b2b7f7e..9080a72 100644 --- a/linkhash.h +++ b/linkhash.h @@ -332,7 +332,14 @@ int lh_table_resize(struct lh_table *t, int new_size); * @param k a pointer to the key to lookup * @return the key's hash */ +#if !defined(_MSC_VER) || (_MSC_VER > 1800) +static inline unsigned long lh_get_hash(const struct lh_table *t, const void *k) +{ + return t->hash_fn(k); +} +#else unsigned long lh_get_hash(const struct lh_table *t, const void *k); +#endif /* Don't use this outside of linkhash.h: */ #ifdef __UNCONST