1
0
Fork 0

Hashmap: Change Lth_HashFindItr's parameters

master
Marrub 2016-10-21 14:43:59 -04:00
parent c500b83948
commit b745b2eb3f
1 changed files with 2 additions and 5 deletions

View File

@ -108,13 +108,10 @@ static inline void Lth_HashMapBuild(Lth_HashMap *map)
// //
// Lth_HashMapFindItr // Lth_HashMapFindItr
// //
static inline Lth_HashMapElem *Lth_HashFindItr(Lth_HashMap *map, static inline Lth_HashMapElem *Lth_HashFindItr(Lth_HashMap *map, size_t hash)
char const *key)
{ {
if(map->table == NULL) return NULL; if(map->table == NULL) return NULL;
size_t hash = Lth_Hash_char(key);
for(Lth_HashMapElem *elem = map->table[hash % map->elem.size]; elem; for(Lth_HashMapElem *elem = map->table[hash % map->elem.size]; elem;
elem = elem->next) elem = elem->next)
{ {
@ -130,7 +127,7 @@ static inline Lth_HashMapElem *Lth_HashFindItr(Lth_HashMap *map,
// //
static inline void *Lth_HashMapFind(Lth_HashMap *map, char const *key) static inline void *Lth_HashMapFind(Lth_HashMap *map, char const *key)
{ {
Lth_HashMapElem *elem = Lth_HashFindItr(map, key); Lth_HashMapElem *elem = Lth_HashFindItr(map, Lth_Hash_char(key));
if(elem == NULL) return NULL; if(elem == NULL) return NULL;
return elem->value; return elem->value;
} }