summaryrefslogtreecommitdiff
path: root/hashmap.c
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-10-06 23:30:28 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-10-07 01:20:10 (GMT)
commitf6eb6bdcf2719defc3d38e0e2712fa3e18d29e91 (patch)
treec66cbc464d075f07fedf1ab338a33fbc66c46638 /hashmap.c
parentd22245a2e360d2e708ca37169be8eb5a5899b98d (diff)
downloadgit-f6eb6bdcf2719defc3d38e0e2712fa3e18d29e91.zip
git-f6eb6bdcf2719defc3d38e0e2712fa3e18d29e91.tar.gz
git-f6eb6bdcf2719defc3d38e0e2712fa3e18d29e91.tar.bz2
hashmap_get_next 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>
Diffstat (limited to 'hashmap.c')
-rw-r--r--hashmap.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/hashmap.c b/hashmap.c
index 6818c65..c1de40e 100644
--- a/hashmap.c
+++ b/hashmap.c
@@ -191,9 +191,10 @@ void *hashmap_get(const struct hashmap *map, const void *key, const void *keydat
return *find_entry_ptr(map, key, keydata);
}
-void *hashmap_get_next(const struct hashmap *map, const void *entry)
+void *hashmap_get_next(const struct hashmap *map,
+ const struct hashmap_entry *entry)
{
- struct hashmap_entry *e = ((struct hashmap_entry *) entry)->next;
+ struct hashmap_entry *e = entry->next;
for (; e; e = e->next)
if (entry_equals(map, entry, e, NULL))
return e;