Util: Ensure key sizes match before comparing

This commit is contained in:
Vicki Pfau 2020-08-17 01:10:02 -07:00
parent 343812e9e6
commit a9e0935af8
1 changed files with 1 additions and 1 deletions

View File

@ -14,7 +14,7 @@
#define TABLE_COMPARATOR(LIST, INDEX) LIST->list[(INDEX)].key == key #define TABLE_COMPARATOR(LIST, INDEX) LIST->list[(INDEX)].key == key
#define HASH_TABLE_STRNCMP_COMPARATOR(LIST, INDEX) LIST->list[(INDEX)].key == hash && strncmp(LIST->list[(INDEX)].stringKey, key, LIST->list[(INDEX)].keylen) == 0 #define HASH_TABLE_STRNCMP_COMPARATOR(LIST, INDEX) LIST->list[(INDEX)].key == hash && strncmp(LIST->list[(INDEX)].stringKey, key, LIST->list[(INDEX)].keylen) == 0
#define HASH_TABLE_MEMCMP_COMPARATOR(LIST, INDEX) LIST->list[(INDEX)].key == hash && memcmp(LIST->list[(INDEX)].stringKey, key, LIST->list[(INDEX)].keylen) == 0 #define HASH_TABLE_MEMCMP_COMPARATOR(LIST, INDEX) LIST->list[(INDEX)].key == hash && LIST->list[(INDEX)].keylen == keylen && memcmp(LIST->list[(INDEX)].stringKey, key, LIST->list[(INDEX)].keylen) == 0
#define TABLE_LOOKUP_START(COMPARATOR, LIST) \ #define TABLE_LOOKUP_START(COMPARATOR, LIST) \
size_t i; \ size_t i; \