summaryrefslogtreecommitdiff
path: root/t/helper/test-hashmap.c
diff options
context:
space:
mode:
authorLibravatar Eric Wong <e@80x24.org>2019-10-06 23:30:34 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-10-07 10:20:10 +0900
commit6bcbdfb277bdc81b5ad6996b3fb005382a35c2ee (patch)
treed2c5a170735b75f905cfe0314aec1d6431e6142a /t/helper/test-hashmap.c
parentintroduce container_of macro (diff)
downloadtgif-6bcbdfb277bdc81b5ad6996b3fb005382a35c2ee.tar.xz
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 <e@80x24.org> Reviewed-by: Derrick Stolee <stolee@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/helper/test-hashmap.c')
-rw-r--r--t/helper/test-hashmap.c10
1 files changed, 6 insertions, 4 deletions
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) {