]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/fast-export.c
hashmap: remove type arg from hashmap_{get,put,remove}_entry
[thirdparty/git.git] / builtin / fast-export.c
index f541f55d333b7a29fcdca88919dc316a1fe0b931..e3de403efdbe0cb569f9068bc3ae0ffa2639810d 100644 (file)
@@ -126,10 +126,15 @@ struct anonymized_entry {
 };
 
 static int anonymized_entry_cmp(const void *unused_cmp_data,
-                               const void *va, const void *vb,
+                               const struct hashmap_entry *eptr,
+                               const struct hashmap_entry *entry_or_key,
                                const void *unused_keydata)
 {
-       const struct anonymized_entry *a = va, *b = vb;
+       const struct anonymized_entry *a, *b;
+
+       a = container_of(eptr, const struct anonymized_entry, hash);
+       b = container_of(entry_or_key, const struct anonymized_entry, hash);
+
        return a->orig_len != b->orig_len ||
                memcmp(a->orig, b->orig, a->orig_len);
 }
@@ -148,10 +153,10 @@ static const void *anonymize_mem(struct hashmap *map,
        if (!map->cmpfn)
                hashmap_init(map, anonymized_entry_cmp, NULL, 0);
 
-       hashmap_entry_init(&key, memhash(orig, *len));
+       hashmap_entry_init(&key.hash, memhash(orig, *len));
        key.orig = orig;
        key.orig_len = *len;
-       ret = hashmap_get(map, &key, NULL);
+       ret = hashmap_get_entry(map, &key, hash, NULL);
 
        if (!ret) {
                ret = xmalloc(sizeof(*ret));
@@ -160,7 +165,7 @@ static const void *anonymize_mem(struct hashmap *map,
                ret->orig_len = *len;
                ret->anon = generate(orig, len);
                ret->anon_len = *len;
-               hashmap_put(map, ret);
+               hashmap_put(map, &ret->hash);
        }
 
        *len = ret->anon_len;