]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/describe.c
hashmap_cmp_fn takes hashmap_entry params
[thirdparty/git.git] / builtin / describe.c
index 1409cedce2fb08dc24b57db9e3a3591c3760d8af..e9267b5c9c4cccf174a67bdf186b307fba8cd68e 100644 (file)
@@ -64,19 +64,22 @@ static const char *prio_names[] = {
 };
 
 static int commit_name_neq(const void *unused_cmp_data,
-                          const void *entry,
-                          const void *entry_or_key,
+                          const struct hashmap_entry *eptr,
+                          const struct hashmap_entry *entry_or_key,
                           const void *peeled)
 {
-       const struct commit_name *cn1 = entry;
-       const struct commit_name *cn2 = entry_or_key;
+       const struct commit_name *cn1, *cn2;
+
+       cn1 = container_of(eptr, const struct commit_name, entry);
+       cn2 = container_of(entry_or_key, const struct commit_name, entry);
 
        return !oideq(&cn1->peeled, peeled ? peeled : &cn2->peeled);
 }
 
 static inline struct commit_name *find_commit_name(const struct object_id *peeled)
 {
-       return hashmap_get_from_hash(&names, sha1hash(peeled->hash), peeled->hash);
+       return hashmap_get_entry_from_hash(&names, oidhash(peeled), peeled,
+                                               struct commit_name, entry);
 }
 
 static int replace_name(struct commit_name *e,
@@ -123,8 +126,8 @@ static void add_to_known_names(const char *path,
                if (!e) {
                        e = xmalloc(sizeof(struct commit_name));
                        oidcpy(&e->peeled, peeled);
-                       hashmap_entry_init(e, sha1hash(peeled->hash));
-                       hashmap_add(&names, e);
+                       hashmap_entry_init(&e->entry, oidhash(peeled));
+                       hashmap_add(&names, &e->entry);
                        e->path = NULL;
                }
                e->tag = tag;