From 6bcbdfb277bdc81b5ad6996b3fb005382a35c2ee Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 6 Oct 2019 23:30:34 +0000 Subject: hashmap_get_next returns "struct hashmap_entry *" This is a step towards removing the requirement for hashmap_entry being the first field of a struct. Signed-off-by: Eric Wong Reviewed-by: Derrick Stolee Signed-off-by: Junio C Hamano --- t/helper/test-hashmap.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 't/helper/test-hashmap.c') diff --git a/t/helper/test-hashmap.c b/t/helper/test-hashmap.c index de2bd083b9..d85b8dc58e 100644 --- a/t/helper/test-hashmap.c +++ b/t/helper/test-hashmap.c @@ -194,16 +194,18 @@ int cmd__hashmap(int argc, const char **argv) free(entry); } else if (!strcmp("get", cmd) && p1) { + struct hashmap_entry *e; /* lookup entry in hashmap */ - entry = hashmap_get_from_hash(&map, hash, p1); + e = hashmap_get_from_hash(&map, hash, p1); /* print result */ - if (!entry) + if (!e) puts("NULL"); - while (entry) { + while (e) { + entry = container_of(e, struct test_entry, ent); puts(get_value(entry)); - entry = hashmap_get_next(&map, &entry->ent); + e = hashmap_get_next(&map, e); } } else if (!strcmp("remove", cmd) && p1) { -- cgit v1.2.3