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>
This commit is contained in:
Eric Wong
2019-10-06 23:30:34 +00:00
committed by Junio C Hamano
parent 973d5eea74
commit 6bcbdfb277
6 changed files with 39 additions and 23 deletions

View File

@ -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) {