]> git.ipfire.org Git - thirdparty/git.git/blobdiff - test-hashmap.c
hashmap: add simplified hashmap_get_from_hash() API
[thirdparty/git.git] / test-hashmap.c
index f5183fb9e82575c86355b690178a8c3d96175eb4..3c9f67bcb275a0378da95bdf020dfac89ebdecb0 100644 (file)
@@ -115,9 +115,8 @@ static void perf_hashmap(unsigned int method, unsigned int rounds)
 
                for (j = 0; j < rounds; j++) {
                        for (i = 0; i < TEST_SIZE; i++) {
-                               struct hashmap_entry key;
-                               hashmap_entry_init(&key, hashes[i]);
-                               hashmap_get(&map, &key, entries[i]->key);
+                               hashmap_get_from_hash(&map, hashes[i],
+                                                     entries[i]->key);
                        }
                }
 
@@ -199,12 +198,8 @@ int main(int argc, char *argv[])
 
                } else if (!strcmp("get", cmd) && l1) {
 
-                       /* setup static key */
-                       struct hashmap_entry key;
-                       hashmap_entry_init(&key, hash);
-
                        /* lookup entry in hashmap */
-                       entry = hashmap_get(&map, &key, p1);
+                       entry = hashmap_get_from_hash(&map, hash, p1);
 
                        /* print result */
                        if (!entry)