From dfdb7d9c144bb2462c21787a71b2750fb42796e9 Mon Sep 17 00:00:00 2001 From: Sean Barrett Date: Mon, 13 Jul 2020 02:42:37 -0700 Subject: [PATCH] stb_ds: use keyoffset in key comparison --- stb_ds.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stb_ds.h b/stb_ds.h index 4c1b221..730143f 100644 --- a/stb_ds.h +++ b/stb_ds.h @@ -1167,9 +1167,9 @@ size_t stbds_hash_bytes(void *p, size_t len, size_t seed) static int stbds_is_key_equal(void *a, size_t elemsize, void *key, size_t keysize, size_t keyoffset, int mode, size_t i) { if (mode >= STBDS_HM_STRING) - return 0==strcmp((char *) key, * (char **) ((char *) a + elemsize*i)); + return 0==strcmp((char *) key, * (char **) ((char *) a + elemsize*i + keyoffset)); else - return 0==memcmp(key, (char *) a + elemsize*i, keysize); + return 0==memcmp(key, (char *) a + elemsize*i + keyoffset, keysize); } #define STBDS_HASH_TO_ARR(x,elemsize) ((char*) (x) - (elemsize))