From d878f6fb9bb3f700778202b437ab34e68a364440 Mon Sep 17 00:00:00 2001 From: Tyge Løvset <60263450+tylo-work@users.noreply.github.com> Date: Sat, 14 Mar 2020 01:12:06 +0100 Subject: bug fix --- clib/cmap.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/clib/cmap.h b/clib/cmap.h index 442f714b..33f0469d 100644 --- a/clib/cmap.h +++ b/clib/cmap.h @@ -57,10 +57,10 @@ typedef struct CMapEntry_##tag CMapEntry_##tag declare_CMap_4(tag, Key, Value, c_defaultDestroy) #define declare_CMap_4(tag, Key, Value, valueDestroy) \ - declare_CMap_6(tag, Key, Value, valueDestroy, memcmp, c_murmurHash) + declare_CMap_7(tag, Key, Value, valueDestroy, memcmp, c_murmurHash, c_defaultDestroy) -#define declare_CMap_6(tag, Key, Value, valueDestroy, keyCompare, keyHash) \ - declare_CMap_10(tag, Key, Value, valueDestroy, keyCompare, keyHash, c_defaultDestroy, Key, c_defaultGetRaw, c_defaultInitRaw) +#define declare_CMap_7(tag, Key, Value, valueDestroy, keyCompare, keyHash, keyDestroy) \ + declare_CMap_10(tag, Key, Value, valueDestroy, keyCompare, keyHash, keyDestroy, Key, c_defaultGetRaw, c_defaultInitRaw) // CMap: @@ -71,12 +71,12 @@ typedef struct CMapEntry_##tag CMapEntry_##tag #define declare_CMap_stringkey_3(tag, Value, valueDestroy) \ declare_CMap_10(tag, CString, Value, valueDestroy, cstring_compareRaw, cstring_hashRaw, cstring_destroy, \ - const char*, cstring_getRaw, cstring_make) + const char*, cstring_getRaw, cstring_make) // CMap full: #define declare_CMap_10(tag, Key, Value, valueDestroy, keyCompareRaw, keyHashRaw, keyDestroy, \ - KeyRaw, keyGetRaw, keyInitRaw) \ + KeyRaw, keyGetRaw, keyInitRaw) \ declare_CMapEntry(tag, Key, Value, valueDestroy, keyDestroy); \ declare_CVector_3(map_##tag, CMapEntry_##tag, cmapentry_##tag##_destroy); \ \ @@ -143,7 +143,7 @@ static inline size_t cmap_##tag##_bucket(CMap_##tag* self, KeyRaw rawKey) { \ break; \ } \ /*++m; if ((idx = first + m*m) >= cap) idx %= cap;*/ \ - if (++idx > cap) idx = 0; \ + if (++idx == cap) idx = 0; \ } while (1); \ } \ \ -- cgit v1.2.3