hashmap_get takes "const struct hashmap_entry *"
This is less error-prone than "const void *" as the compiler now detects invalid types being passed. Signed-off-by: Eric Wong <e@80x24.org> Reviewed-by: Derrick Stolee <stolee@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
b94e5c1df6
commit
b6c5241606
@ -186,7 +186,8 @@ void hashmap_free(struct hashmap *map, int free_entries)
|
||||
memset(map, 0, sizeof(*map));
|
||||
}
|
||||
|
||||
void *hashmap_get(const struct hashmap *map, const void *key, const void *keydata)
|
||||
void *hashmap_get(const struct hashmap *map, const struct hashmap_entry *key,
|
||||
const void *keydata)
|
||||
{
|
||||
return *find_entry_ptr(map, key, keydata);
|
||||
}
|
||||
@ -296,7 +297,7 @@ const void *memintern(const void *data, size_t len)
|
||||
/* lookup interned string in pool */
|
||||
hashmap_entry_init(&key.ent, memhash(data, len));
|
||||
key.len = len;
|
||||
e = hashmap_get(&map, &key, data);
|
||||
e = hashmap_get(&map, &key.ent, data);
|
||||
if (!e) {
|
||||
/* not found: create it */
|
||||
FLEX_ALLOC_MEM(e, data, data, len);
|
||||
|
Reference in New Issue
Block a user