]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/fast-export.c
Merge branch 'js/update-index-ignore-removal-for-skip-worktree'
[thirdparty/git.git] / builtin / fast-export.c
index 58a74de42a0c9bc121f3f687c355192b9841ed16..dbec4df92bd7229b1a46f56f27b4e29c706fc214 100644 (file)
@@ -127,10 +127,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);
 }
@@ -149,10 +154,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));
@@ -161,7 +166,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;