]> git.ipfire.org Git - thirdparty/git.git/commitdiff
hashmap_entry_init takes "struct hashmap_entry *"
authorEric Wong <e@80x24.org>
Sun, 6 Oct 2019 23:30:27 +0000 (23:30 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 7 Oct 2019 01:20:09 +0000 (10:20 +0900)
C compilers do type checking to make life easier for us.  So
rely on that and update all hashmap_entry_init callers to take
"struct hashmap_entry *" to avoid future bugs while improving
safety and readability.

Signed-off-by: Eric Wong <e@80x24.org>
Reviewed-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 files changed:
attr.c
blame.c
builtin/describe.c
builtin/difftool.c
builtin/fast-export.c
builtin/fetch.c
config.c
diffcore-rename.c
hashmap.c
hashmap.h
merge-recursive.c
name-hash.c
packfile.c
patch-ids.c
range-diff.c
ref-filter.c
refs.c
remote.c
revision.c
sequencer.c
sub-process.c
submodule-config.c
t/helper/test-hashmap.c

diff --git a/attr.c b/attr.c
index 93dc16b59cd6eff1d5c962ac2c4b01662948a93e..a8be7a7b4faffc18f92200fde91fbce191f1083d 100644 (file)
--- a/attr.c
+++ b/attr.c
@@ -98,7 +98,7 @@ static void *attr_hashmap_get(struct attr_hashmap *map,
        if (!map->map.tablesize)
                attr_hashmap_init(map);
 
-       hashmap_entry_init(&k, memhash(key, keylen));
+       hashmap_entry_init(&k.ent, memhash(key, keylen));
        k.key = key;
        k.keylen = keylen;
        e = hashmap_get(&map->map, &k, NULL);
@@ -117,7 +117,7 @@ static void attr_hashmap_add(struct attr_hashmap *map,
                attr_hashmap_init(map);
 
        e = xmalloc(sizeof(struct attr_hash_entry));
-       hashmap_entry_init(e, memhash(key, keylen));
+       hashmap_entry_init(&e->ent, memhash(key, keylen));
        e->key = key;
        e->keylen = keylen;
        e->value = value;
diff --git a/blame.c b/blame.c
index 36a2e7ef119d7bea691babe15f861a0600028196..46059410cd6af875da8a65dad7b1cbe568e7fc0e 100644 (file)
--- a/blame.c
+++ b/blame.c
@@ -417,7 +417,7 @@ static void get_fingerprint(struct fingerprint *result,
                /* Ignore whitespace pairs */
                if (hash == 0)
                        continue;
-               hashmap_entry_init(entry, hash);
+               hashmap_entry_init(&entry->entry, hash);
 
                found_entry = hashmap_get(&result->map, entry, NULL);
                if (found_entry) {
index 200154297d5ea8baddda52e39cd4de302595bfcc..596ddf89a5126ffb561ca187579e1c137598b38f 100644 (file)
@@ -123,7 +123,7 @@ 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, oidhash(peeled));
+                       hashmap_entry_init(&e->entry, oidhash(peeled));
                        hashmap_add(&names, e);
                        e->path = NULL;
                }
index 16eb8b70ea33eb00516d7ab035a90df9728d5296..98ffc04c61e64388aad5543d56399a1a6c29516b 100644 (file)
@@ -161,7 +161,7 @@ static void add_left_or_right(struct hashmap *map, const char *path,
        struct pair_entry *e, *existing;
 
        FLEX_ALLOC_STR(e, path, path);
-       hashmap_entry_init(e, strhash(path));
+       hashmap_entry_init(&e->entry, strhash(path));
        existing = hashmap_get(map, e, NULL);
        if (existing) {
                free(e);
@@ -234,7 +234,7 @@ static void changed_files(struct hashmap *result, const char *index_path,
        while (!strbuf_getline_nul(&buf, fp)) {
                struct path_entry *entry;
                FLEX_ALLOC_STR(entry, path, buf.buf);
-               hashmap_entry_init(entry, strhash(buf.buf));
+               hashmap_entry_init(&entry->entry, strhash(buf.buf));
                hashmap_add(result, entry);
        }
        fclose(fp);
@@ -461,7 +461,7 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix,
 
                        /* Avoid duplicate working_tree entries */
                        FLEX_ALLOC_STR(entry, path, dst_path);
-                       hashmap_entry_init(entry, strhash(dst_path));
+                       hashmap_entry_init(&entry->entry, strhash(dst_path));
                        if (hashmap_get(&working_tree_dups, entry, NULL)) {
                                free(entry);
                                continue;
index f541f55d333b7a29fcdca88919dc316a1fe0b931..287dbd24a30ff02cfcb1f624a4bebca54b9d4a29 100644 (file)
@@ -148,7 +148,7 @@ 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);
index 717dd14e896117c56101f7f56df0261576c323d0..b7d70eee702bcedbaacafd5b990692cec6bd91f9 100644 (file)
@@ -276,7 +276,7 @@ static struct refname_hash_entry *refname_hash_add(struct hashmap *map,
        size_t len = strlen(refname);
 
        FLEX_ALLOC_MEM(ent, refname, refname, len);
-       hashmap_entry_init(ent, strhash(refname));
+       hashmap_entry_init(&ent->ent, strhash(refname));
        oidcpy(&ent->oid, oid);
        hashmap_add(map, ent);
        return ent;
index 3900e4947be92b916ed9b531eb455e8f856105dc..08d866e7dea8283f97831f38832bfe57a0620437 100644 (file)
--- a/config.c
+++ b/config.c
@@ -1861,7 +1861,7 @@ static struct config_set_element *configset_find_element(struct config_set *cs,
        if (git_config_parse_key(key, &normalized_key, NULL))
                return NULL;
 
-       hashmap_entry_init(&k, strhash(normalized_key));
+       hashmap_entry_init(&k.ent, strhash(normalized_key));
        k.key = normalized_key;
        found_entry = hashmap_get(&cs->config_hash, &k, NULL);
        free(normalized_key);
@@ -1882,7 +1882,7 @@ static int configset_add_value(struct config_set *cs, const char *key, const cha
         */
        if (!e) {
                e = xmalloc(sizeof(*e));
-               hashmap_entry_init(e, strhash(key));
+               hashmap_entry_init(&e->ent, strhash(key));
                e->key = xstrdup(key);
                string_list_init(&e->value_list, 1);
                hashmap_add(&cs->config_hash, e);
index 9624864858dcb4e99d793858c3fe4885d18134e3..44a3ab1e3165c5f2ec5debf8fc78f9b1db7f0060 100644 (file)
@@ -329,7 +329,7 @@ static void insert_file_table(struct repository *r,
        entry->index = index;
        entry->filespec = filespec;
 
-       hashmap_entry_init(entry, hash_filespec(r, filespec));
+       hashmap_entry_init(&entry->entry, hash_filespec(r, filespec));
        hashmap_add(table, entry);
 }
 
index d42f01ff5ae6f3494d5b427c64bc64406c35d576..6818c65174869406f57fc0cea79fda4af8c63938 100644 (file)
--- a/hashmap.c
+++ b/hashmap.c
@@ -293,13 +293,13 @@ const void *memintern(const void *data, size_t len)
                hashmap_init(&map, (hashmap_cmp_fn) pool_entry_cmp, NULL, 0);
 
        /* lookup interned string in pool */
-       hashmap_entry_init(&key, memhash(data, len));
+       hashmap_entry_init(&key.ent, memhash(data, len));
        key.len = len;
        e = hashmap_get(&map, &key, data);
        if (!e) {
                /* not found: create it */
                FLEX_ALLOC_MEM(e, data, data, len);
-               hashmap_entry_init(e, key.ent.hash);
+               hashmap_entry_init(&e->ent, key.ent.hash);
                e->len = len;
                hashmap_add(&map, e);
        }
index 84249115664b4a3d576c619075cb8ca396fff0ed..54b0b8c698013ff56372c51af4cad3ee28b97cd9 100644 (file)
--- a/hashmap.h
+++ b/hashmap.h
  *         if (!strcmp("add", action)) {
  *             struct long2string *e;
  *             FLEX_ALLOC_STR(e, value, value);
- *             hashmap_entry_init(e, memhash(&key, sizeof(long)));
+ *             hashmap_entry_init(&e->ent, memhash(&key, sizeof(long)));
  *             e->key = key;
  *             hashmap_add(&map, e);
  *         }
  *
  *         if (!strcmp("print_all_by_key", action)) {
  *             struct long2string k, *e;
- *             hashmap_entry_init(&k, memhash(&key, sizeof(long)));
+ *             hashmap_entry_init(&k->ent, memhash(&key, sizeof(long)));
  *             k.key = key;
  *
  *             flags &= ~COMPARE_VALUE;
@@ -70,7 +70,7 @@
  *         if (!strcmp("has_exact_match", action)) {
  *             struct long2string *e;
  *             FLEX_ALLOC_STR(e, value, value);
- *             hashmap_entry_init(e, memhash(&key, sizeof(long)));
+ *             hashmap_entry_init(&e->ent, memhash(&key, sizeof(long)));
  *             e->key = key;
  *
  *             flags |= COMPARE_VALUE;
@@ -80,7 +80,7 @@
  *
  *         if (!strcmp("has_exact_match_no_heap_alloc", action)) {
  *             struct long2string k;
- *             hashmap_entry_init(&k, memhash(&key, sizeof(long)));
+ *             hashmap_entry_init(&k->ent, memhash(&key, sizeof(long)));
  *             k.key = key;
  *
  *             flags |= COMPARE_VALUE;
@@ -244,9 +244,9 @@ void hashmap_free(struct hashmap *map, int free_entries);
  * your structure was allocated with xmalloc(), you can just free(3) it,
  * and if it is on stack, you can just let it go out of scope).
  */
-static inline void hashmap_entry_init(void *entry, unsigned int hash)
+static inline void hashmap_entry_init(struct hashmap_entry *e,
+                                       unsigned int hash)
 {
-       struct hashmap_entry *e = entry;
        e->hash = hash;
        e->next = NULL;
 }
index 6b812d67e3ecd54ece21c2465ede3e28d6fba325..6bc4f14ff4117bcabd127a7ce72c115db8a4b8fa 100644 (file)
@@ -61,7 +61,7 @@ static struct dir_rename_entry *dir_rename_find_entry(struct hashmap *hashmap,
 
        if (dir == NULL)
                return NULL;
-       hashmap_entry_init(&key, strhash(dir));
+       hashmap_entry_init(&key.ent, strhash(dir));
        key.dir = dir;
        return hashmap_get(hashmap, &key, NULL);
 }
@@ -85,7 +85,7 @@ static void dir_rename_init(struct hashmap *map)
 static void dir_rename_entry_init(struct dir_rename_entry *entry,
                                  char *directory)
 {
-       hashmap_entry_init(entry, strhash(directory));
+       hashmap_entry_init(&entry->ent, strhash(directory));
        entry->dir = directory;
        entry->non_unique_new_dir = 0;
        strbuf_init(&entry->new_dir, 0);
@@ -97,7 +97,7 @@ static struct collision_entry *collision_find_entry(struct hashmap *hashmap,
 {
        struct collision_entry key;
 
-       hashmap_entry_init(&key, strhash(target_file));
+       hashmap_entry_init(&key.ent, strhash(target_file));
        key.target_file = target_file;
        return hashmap_get(hashmap, &key, NULL);
 }
@@ -454,7 +454,7 @@ static int save_files_dirs(const struct object_id *oid,
        strbuf_addstr(base, path);
 
        FLEX_ALLOC_MEM(entry, path, base->buf, base->len);
-       hashmap_entry_init(entry, path_hash(entry->path));
+       hashmap_entry_init(&entry->e, path_hash(entry->path));
        hashmap_add(&opt->current_file_dir_set, entry);
 
        strbuf_setlen(base, baselen);
@@ -731,7 +731,7 @@ static char *unique_path(struct merge_options *opt, const char *path, const char
        }
 
        FLEX_ALLOC_MEM(entry, path, newpath.buf, newpath.len);
-       hashmap_entry_init(entry, path_hash(entry->path));
+       hashmap_entry_init(&entry->e, path_hash(entry->path));
        hashmap_add(&opt->current_file_dir_set, entry);
        return strbuf_detach(&newpath, NULL);
 }
@@ -2358,7 +2358,8 @@ static void compute_collisions(struct hashmap *collisions,
                if (!collision_ent) {
                        collision_ent = xcalloc(1,
                                                sizeof(struct collision_entry));
-                       hashmap_entry_init(collision_ent, strhash(new_path));
+                       hashmap_entry_init(&collision_ent->ent,
+                                               strhash(new_path));
                        hashmap_put(collisions, collision_ent);
                        collision_ent->target_file = new_path;
                } else {
index 695908609f40f9cbb3960162a311af5d452610e2..1ce1417f7edc5a3be97fb63fbe704705f46ca2ee 100644 (file)
@@ -33,7 +33,7 @@ static struct dir_entry *find_dir_entry__hash(struct index_state *istate,
                const char *name, unsigned int namelen, unsigned int hash)
 {
        struct dir_entry key;
-       hashmap_entry_init(&key, hash);
+       hashmap_entry_init(&key.ent, hash);
        key.namelen = namelen;
        return hashmap_get(&istate->dir_hash, &key, name);
 }
@@ -68,7 +68,7 @@ static struct dir_entry *hash_dir_entry(struct index_state *istate,
        if (!dir) {
                /* not found, create it and add to hash table */
                FLEX_ALLOC_MEM(dir, name, ce->name, namelen);
-               hashmap_entry_init(dir, memihash(ce->name, namelen));
+               hashmap_entry_init(&dir->ent, memihash(ce->name, namelen));
                dir->namelen = namelen;
                hashmap_add(&istate->dir_hash, dir);
 
@@ -106,7 +106,7 @@ static void hash_index_entry(struct index_state *istate, struct cache_entry *ce)
        if (ce->ce_flags & CE_HASHED)
                return;
        ce->ce_flags |= CE_HASHED;
-       hashmap_entry_init(ce, memihash(ce->name, ce_namelen(ce)));
+       hashmap_entry_init(&ce->ent, memihash(ce->name, ce_namelen(ce)));
        hashmap_add(&istate->name_hash, ce);
 
        if (ignore_case)
@@ -280,7 +280,7 @@ static struct dir_entry *hash_dir_entry_with_parent_and_prefix(
        dir = find_dir_entry__hash(istate, prefix->buf, prefix->len, hash);
        if (!dir) {
                FLEX_ALLOC_MEM(dir, name, prefix->buf, prefix->len);
-               hashmap_entry_init(dir, hash);
+               hashmap_entry_init(&dir->ent, hash);
                dir->namelen = prefix->len;
                dir->parent = parent;
                hashmap_add(&istate->dir_hash, dir);
@@ -472,7 +472,7 @@ static void *lazy_name_thread_proc(void *_data)
        for (k = 0; k < d->istate->cache_nr; k++) {
                struct cache_entry *ce_k = d->istate->cache[k];
                ce_k->ce_flags |= CE_HASHED;
-               hashmap_entry_init(ce_k, d->lazy_entries[k].hash_name);
+               hashmap_entry_init(&ce_k->ent, d->lazy_entries[k].hash_name);
                hashmap_add(&d->istate->name_hash, ce_k);
        }
 
index 37fe0b73a6b1e5ba75aba6c32962392d9d7e48e3..96535eb86bde9206a779b0f1bfe0c31770b02570 100644 (file)
@@ -1487,7 +1487,7 @@ static void add_delta_base_cache(struct packed_git *p, off_t base_offset,
 
        if (!delta_base_cache.cmpfn)
                hashmap_init(&delta_base_cache, delta_base_cache_hash_cmp, NULL, 0);
-       hashmap_entry_init(ent, pack_entry_hash(p, base_offset));
+       hashmap_entry_init(&ent->ent, pack_entry_hash(p, base_offset));
        hashmap_add(&delta_base_cache, ent);
 }
 
index e8c150d0c92a5f796011e811b750c783d1eee9db..a2da711678d8965d8220a7e9d746e433326f2da9 100644 (file)
@@ -83,7 +83,7 @@ static int init_patch_id_entry(struct patch_id *patch,
        if (commit_patch_id(commit, &ids->diffopts, &header_only_patch_id, 1, 0))
                return -1;
 
-       hashmap_entry_init(patch, oidhash(&header_only_patch_id));
+       hashmap_entry_init(&patch->ent, oidhash(&header_only_patch_id));
        return 0;
 }
 
index ba1e9a4265a6cb3e6ae77b2f32f9fd64bee04cc6..32b29f9594705766e3ef7229f7f9159df9690bb3 100644 (file)
@@ -217,7 +217,7 @@ static void find_exact_matches(struct string_list *a, struct string_list *b)
                util->i = i;
                util->patch = a->items[i].string;
                util->diff = util->patch + util->diff_offset;
-               hashmap_entry_init(util, strhash(util->diff));
+               hashmap_entry_init(&util->e, strhash(util->diff));
                hashmap_add(&map, util);
        }
 
@@ -228,7 +228,7 @@ static void find_exact_matches(struct string_list *a, struct string_list *b)
                util->i = i;
                util->patch = b->items[i].string;
                util->diff = util->patch + util->diff_offset;
-               hashmap_entry_init(util, strhash(util->diff));
+               hashmap_entry_init(&util->e, strhash(util->diff));
                other = hashmap_remove(&map, util, NULL);
                if (other) {
                        if (other->matching >= 0)
index f27cfc8c3e358fa27d7aec78c0b3c44c816402b3..206014c93d2b3175675936cf5993844c58c3d7bb 100644 (file)
@@ -1565,7 +1565,8 @@ static void populate_worktree_map(struct hashmap *map, struct worktree **worktre
                        struct ref_to_worktree_entry *entry;
                        entry = xmalloc(sizeof(*entry));
                        entry->wt = worktrees[i];
-                       hashmap_entry_init(entry, strhash(worktrees[i]->head_ref));
+                       hashmap_entry_init(&entry->ent,
+                                       strhash(worktrees[i]->head_ref));
 
                        hashmap_add(map, entry);
                }
diff --git a/refs.c b/refs.c
index cd297ee4bdbe48b04696ddf923273a857ce59884..c43ec59c6e845d55848c6e8474e6a54f2022b222 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -1796,7 +1796,7 @@ static struct ref_store_hash_entry *alloc_ref_store_hash_entry(
        struct ref_store_hash_entry *entry;
 
        FLEX_ALLOC_STR(entry, name, name);
-       hashmap_entry_init(entry, strhash(name));
+       hashmap_entry_init(&entry->ent, strhash(name));
        entry->refs = refs;
        return entry;
 }
index e50f7602eda56e0fb9deeedcd9d3d4e0a800a822..bd81cb71bc1fcdb894f72ee5ee39325d2bca2062 100644 (file)
--- a/remote.c
+++ b/remote.c
@@ -158,7 +158,7 @@ static struct remote *make_remote(const char *name, int len)
        ALLOC_GROW(remotes, remotes_nr + 1, remotes_alloc);
        remotes[remotes_nr++] = ret;
 
-       hashmap_entry_init(ret, lookup_entry.hash);
+       hashmap_entry_init(&ret->ent, lookup_entry.hash);
        replaced = hashmap_put(&remotes_hash, ret);
        assert(replaced == NULL);  /* no previous entry overwritten */
        return ret;
index 07412297f0248aae886eeb77c3a1cab13c93039c..3461c7888387f1ed0c578da0a1cea32cc4c3d9d3 100644 (file)
@@ -141,7 +141,7 @@ static void paths_and_oids_insert(struct hashmap *map,
        struct path_and_oids_entry key;
        struct path_and_oids_entry *entry;
 
-       hashmap_entry_init(&key, hash);
+       hashmap_entry_init(&key.ent, hash);
 
        /* use a shallow copy for the lookup */
        key.path = (char *)path;
@@ -149,7 +149,7 @@ static void paths_and_oids_insert(struct hashmap *map,
 
        if (!(entry = (struct path_and_oids_entry *)hashmap_get(map, &key, NULL))) {
                entry = xcalloc(1, sizeof(struct path_and_oids_entry));
-               hashmap_entry_init(entry, hash);
+               hashmap_entry_init(&entry->ent, hash);
                entry->path = xstrdup(key.path);
                oidset_init(&entry->trees, 16);
                hashmap_put(map, entry);
index 34ebf8ed94ad7d8df6773337d31ff7d9c2c84c4a..1140cdf52676d8446b4442120884d58e963d3920 100644 (file)
@@ -4538,7 +4538,7 @@ static const char *label_oid(struct object_id *oid, const char *label,
        }
 
        FLEX_ALLOC_STR(labels_entry, label, label);
-       hashmap_entry_init(labels_entry, strihash(label));
+       hashmap_entry_init(&labels_entry->entry, strihash(label));
        hashmap_add(&state->labels, labels_entry);
 
        FLEX_ALLOC_STR(string_entry, string, label);
@@ -5252,7 +5252,8 @@ int todo_list_rearrange_squash(struct todo_list *todo_list)
                                                strhash(subject), subject)) {
                        FLEX_ALLOC_MEM(entry, subject, subject, subject_len);
                        entry->i = i;
-                       hashmap_entry_init(entry, strhash(entry->subject));
+                       hashmap_entry_init(&entry->entry,
+                                       strhash(entry->subject));
                        hashmap_put(&subject2item, entry);
                }
        }
index 3f4af935557c5ee22b0b1b9b43d2778161210765..9847dad6fca34fbb181f419456905b5fcc6323bd 100644 (file)
@@ -20,7 +20,7 @@ struct subprocess_entry *subprocess_find_entry(struct hashmap *hashmap, const ch
 {
        struct subprocess_entry key;
 
-       hashmap_entry_init(&key, strhash(cmd));
+       hashmap_entry_init(&key.ent, strhash(cmd));
        key.cmd = cmd;
        return hashmap_get(hashmap, &key, NULL);
 }
@@ -96,7 +96,7 @@ int subprocess_start(struct hashmap *hashmap, struct subprocess_entry *entry, co
                return err;
        }
 
-       hashmap_entry_init(entry, strhash(cmd));
+       hashmap_entry_init(&entry->ent, strhash(cmd));
 
        err = startfn(entry);
        if (err) {
index 4264ee216f49773c86e2e161d28ceec656a1273c..4aa02e280eb5ef5c76a6d7d76647f50f03a7f60e 100644 (file)
@@ -123,7 +123,7 @@ static void cache_put_path(struct submodule_cache *cache,
        unsigned int hash = hash_oid_string(&submodule->gitmodules_oid,
                                            submodule->path);
        struct submodule_entry *e = xmalloc(sizeof(*e));
-       hashmap_entry_init(e, hash);
+       hashmap_entry_init(&e->ent, hash);
        e->config = submodule;
        hashmap_put(&cache->for_path, e);
 }
@@ -135,7 +135,7 @@ static void cache_remove_path(struct submodule_cache *cache,
                                            submodule->path);
        struct submodule_entry e;
        struct submodule_entry *removed;
-       hashmap_entry_init(&e, hash);
+       hashmap_entry_init(&e.ent, hash);
        e.config = submodule;
        removed = hashmap_remove(&cache->for_path, &e, NULL);
        free(removed);
@@ -147,7 +147,7 @@ static void cache_add(struct submodule_cache *cache,
        unsigned int hash = hash_oid_string(&submodule->gitmodules_oid,
                                            submodule->name);
        struct submodule_entry *e = xmalloc(sizeof(*e));
-       hashmap_entry_init(e, hash);
+       hashmap_entry_init(&e->ent, hash);
        e->config = submodule;
        hashmap_add(&cache->for_name, e);
 }
@@ -163,7 +163,7 @@ static const struct submodule *cache_lookup_path(struct submodule_cache *cache,
        oidcpy(&key_config.gitmodules_oid, gitmodules_oid);
        key_config.path = path;
 
-       hashmap_entry_init(&key, hash);
+       hashmap_entry_init(&key.ent, hash);
        key.config = &key_config;
 
        entry = hashmap_get(&cache->for_path, &key, NULL);
@@ -183,7 +183,7 @@ static struct submodule *cache_lookup_name(struct submodule_cache *cache,
        oidcpy(&key_config.gitmodules_oid, gitmodules_oid);
        key_config.name = name;
 
-       hashmap_entry_init(&key, hash);
+       hashmap_entry_init(&key.ent, hash);
        key.config = &key_config;
 
        entry = hashmap_get(&cache->for_name, &key, NULL);
index aaf17b0ddf9e8ddd1270f613f8c71841c6644eb9..0c9fd7c9962c0b3d103e85f4cdf02387fc8f3cbc 100644 (file)
@@ -37,7 +37,7 @@ static struct test_entry *alloc_test_entry(unsigned int hash,
        size_t klen = strlen(key);
        size_t vlen = strlen(value);
        struct test_entry *entry = xmalloc(st_add4(sizeof(*entry), klen, vlen, 2));
-       hashmap_entry_init(entry, hash);
+       hashmap_entry_init(&entry->ent, hash);
        memcpy(entry->key, key, klen + 1);
        memcpy(entry->key + klen + 1, value, vlen + 1);
        return entry;
@@ -103,7 +103,7 @@ static void perf_hashmap(unsigned int method, unsigned int rounds)
 
                        /* add entries */
                        for (i = 0; i < TEST_SIZE; i++) {
-                               hashmap_entry_init(entries[i], hashes[i]);
+                               hashmap_entry_init(&entries[i]->ent, hashes[i]);
                                hashmap_add(&map, entries[i]);
                        }
 
@@ -116,7 +116,7 @@ static void perf_hashmap(unsigned int method, unsigned int rounds)
                /* fill the map (sparsely if specified) */
                j = (method & TEST_SPARSE) ? TEST_SIZE / 10 : TEST_SIZE;
                for (i = 0; i < j; i++) {
-                       hashmap_entry_init(entries[i], hashes[i]);
+                       hashmap_entry_init(&entries[i]->ent, hashes[i]);
                        hashmap_add(&map, entries[i]);
                }