]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/helper/test-hashmap.c
hashmap: use *_entry APIs to wrap container_of
[thirdparty/git.git] / t / helper / test-hashmap.c
index de2bd083b9b1f630450bc9ba9a2c308f9a3cc1aa..e82cbfdee272a8573c625cf5417518a7885497f7 100644 (file)
@@ -194,16 +194,16 @@ int cmd__hashmap(int argc, const char **argv)
                        free(entry);
 
                } else if (!strcmp("get", cmd) && p1) {
-
                        /* lookup entry in hashmap */
-                       entry = hashmap_get_from_hash(&map, hash, p1);
+                       entry = hashmap_get_entry_from_hash(&map, hash, p1,
+                                                       struct test_entry, ent);
 
                        /* print result */
                        if (!entry)
                                puts("NULL");
-                       while (entry) {
+                       hashmap_for_each_entry_from(&map, entry,
+                                               struct test_entry, ent) {
                                puts(get_value(entry));
-                               entry = hashmap_get_next(&map, &entry->ent);
                        }
 
                } else if (!strcmp("remove", cmd) && p1) {