Hashmap: Change Lth_HashFindItr's parameters
parent
c500b83948
commit
b745b2eb3f
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue