From b6c5241606e67b57470e86ccf547d4ab90008a1d Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 6 Oct 2019 23:30:30 +0000 Subject: 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 Reviewed-by: Derrick Stolee Signed-off-by: Junio C Hamano --- hashmap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'hashmap.c') diff --git a/hashmap.c b/hashmap.c index 9c2db3e0c8..092236c09a 100644 --- a/hashmap.c +++ b/hashmap.c @@ -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); -- cgit v1.2.3