Skip to content

Commit d22245a

Browse files
Eric Wonggitster
Eric Wong
authored andcommittedOct 7, 2019
hashmap_entry_init takes "struct hashmap_entry *"
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 <[email protected]> Reviewed-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d0a48a0 commit d22245a

23 files changed

+55
-52
lines changed
 

‎attr.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ static void *attr_hashmap_get(struct attr_hashmap *map,
9898
if (!map->map.tablesize)
9999
attr_hashmap_init(map);
100100

101-
hashmap_entry_init(&k, memhash(key, keylen));
101+
hashmap_entry_init(&k.ent, memhash(key, keylen));
102102
k.key = key;
103103
k.keylen = keylen;
104104
e = hashmap_get(&map->map, &k, NULL);
@@ -117,7 +117,7 @@ static void attr_hashmap_add(struct attr_hashmap *map,
117117
attr_hashmap_init(map);
118118

119119
e = xmalloc(sizeof(struct attr_hash_entry));
120-
hashmap_entry_init(e, memhash(key, keylen));
120+
hashmap_entry_init(&e->ent, memhash(key, keylen));
121121
e->key = key;
122122
e->keylen = keylen;
123123
e->value = value;

‎blame.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ static void get_fingerprint(struct fingerprint *result,
417417
/* Ignore whitespace pairs */
418418
if (hash == 0)
419419
continue;
420-
hashmap_entry_init(entry, hash);
420+
hashmap_entry_init(&entry->entry, hash);
421421

422422
found_entry = hashmap_get(&result->map, entry, NULL);
423423
if (found_entry) {

‎builtin/describe.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ static void add_to_known_names(const char *path,
123123
if (!e) {
124124
e = xmalloc(sizeof(struct commit_name));
125125
oidcpy(&e->peeled, peeled);
126-
hashmap_entry_init(e, oidhash(peeled));
126+
hashmap_entry_init(&e->entry, oidhash(peeled));
127127
hashmap_add(&names, e);
128128
e->path = NULL;
129129
}

‎builtin/difftool.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ static void add_left_or_right(struct hashmap *map, const char *path,
161161
struct pair_entry *e, *existing;
162162

163163
FLEX_ALLOC_STR(e, path, path);
164-
hashmap_entry_init(e, strhash(path));
164+
hashmap_entry_init(&e->entry, strhash(path));
165165
existing = hashmap_get(map, e, NULL);
166166
if (existing) {
167167
free(e);
@@ -234,7 +234,7 @@ static void changed_files(struct hashmap *result, const char *index_path,
234234
while (!strbuf_getline_nul(&buf, fp)) {
235235
struct path_entry *entry;
236236
FLEX_ALLOC_STR(entry, path, buf.buf);
237-
hashmap_entry_init(entry, strhash(buf.buf));
237+
hashmap_entry_init(&entry->entry, strhash(buf.buf));
238238
hashmap_add(result, entry);
239239
}
240240
fclose(fp);
@@ -461,7 +461,7 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix,
461461

462462
/* Avoid duplicate working_tree entries */
463463
FLEX_ALLOC_STR(entry, path, dst_path);
464-
hashmap_entry_init(entry, strhash(dst_path));
464+
hashmap_entry_init(&entry->entry, strhash(dst_path));
465465
if (hashmap_get(&working_tree_dups, entry, NULL)) {
466466
free(entry);
467467
continue;

‎builtin/fast-export.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ static const void *anonymize_mem(struct hashmap *map,
148148
if (!map->cmpfn)
149149
hashmap_init(map, anonymized_entry_cmp, NULL, 0);
150150

151-
hashmap_entry_init(&key, memhash(orig, *len));
151+
hashmap_entry_init(&key.hash, memhash(orig, *len));
152152
key.orig = orig;
153153
key.orig_len = *len;
154154
ret = hashmap_get(map, &key, NULL);

‎builtin/fetch.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ static struct refname_hash_entry *refname_hash_add(struct hashmap *map,
276276
size_t len = strlen(refname);
277277

278278
FLEX_ALLOC_MEM(ent, refname, refname, len);
279-
hashmap_entry_init(ent, strhash(refname));
279+
hashmap_entry_init(&ent->ent, strhash(refname));
280280
oidcpy(&ent->oid, oid);
281281
hashmap_add(map, ent);
282282
return ent;

‎config.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1861,7 +1861,7 @@ static struct config_set_element *configset_find_element(struct config_set *cs,
18611861
if (git_config_parse_key(key, &normalized_key, NULL))
18621862
return NULL;
18631863

1864-
hashmap_entry_init(&k, strhash(normalized_key));
1864+
hashmap_entry_init(&k.ent, strhash(normalized_key));
18651865
k.key = normalized_key;
18661866
found_entry = hashmap_get(&cs->config_hash, &k, NULL);
18671867
free(normalized_key);
@@ -1882,7 +1882,7 @@ static int configset_add_value(struct config_set *cs, const char *key, const cha
18821882
*/
18831883
if (!e) {
18841884
e = xmalloc(sizeof(*e));
1885-
hashmap_entry_init(e, strhash(key));
1885+
hashmap_entry_init(&e->ent, strhash(key));
18861886
e->key = xstrdup(key);
18871887
string_list_init(&e->value_list, 1);
18881888
hashmap_add(&cs->config_hash, e);

‎diffcore-rename.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ static void insert_file_table(struct repository *r,
329329
entry->index = index;
330330
entry->filespec = filespec;
331331

332-
hashmap_entry_init(entry, hash_filespec(r, filespec));
332+
hashmap_entry_init(&entry->entry, hash_filespec(r, filespec));
333333
hashmap_add(table, entry);
334334
}
335335

‎hashmap.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -293,13 +293,13 @@ const void *memintern(const void *data, size_t len)
293293
hashmap_init(&map, (hashmap_cmp_fn) pool_entry_cmp, NULL, 0);
294294

295295
/* lookup interned string in pool */
296-
hashmap_entry_init(&key, memhash(data, len));
296+
hashmap_entry_init(&key.ent, memhash(data, len));
297297
key.len = len;
298298
e = hashmap_get(&map, &key, data);
299299
if (!e) {
300300
/* not found: create it */
301301
FLEX_ALLOC_MEM(e, data, data, len);
302-
hashmap_entry_init(e, key.ent.hash);
302+
hashmap_entry_init(&e->ent, key.ent.hash);
303303
e->len = len;
304304
hashmap_add(&map, e);
305305
}

‎hashmap.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@
4848
* if (!strcmp("add", action)) {
4949
* struct long2string *e;
5050
* FLEX_ALLOC_STR(e, value, value);
51-
* hashmap_entry_init(e, memhash(&key, sizeof(long)));
51+
* hashmap_entry_init(&e->ent, memhash(&key, sizeof(long)));
5252
* e->key = key;
5353
* hashmap_add(&map, e);
5454
* }
5555
*
5656
* if (!strcmp("print_all_by_key", action)) {
5757
* struct long2string k, *e;
58-
* hashmap_entry_init(&k, memhash(&key, sizeof(long)));
58+
* hashmap_entry_init(&k->ent, memhash(&key, sizeof(long)));
5959
* k.key = key;
6060
*
6161
* flags &= ~COMPARE_VALUE;
@@ -70,7 +70,7 @@
7070
* if (!strcmp("has_exact_match", action)) {
7171
* struct long2string *e;
7272
* FLEX_ALLOC_STR(e, value, value);
73-
* hashmap_entry_init(e, memhash(&key, sizeof(long)));
73+
* hashmap_entry_init(&e->ent, memhash(&key, sizeof(long)));
7474
* e->key = key;
7575
*
7676
* flags |= COMPARE_VALUE;
@@ -80,7 +80,7 @@
8080
*
8181
* if (!strcmp("has_exact_match_no_heap_alloc", action)) {
8282
* struct long2string k;
83-
* hashmap_entry_init(&k, memhash(&key, sizeof(long)));
83+
* hashmap_entry_init(&k->ent, memhash(&key, sizeof(long)));
8484
* k.key = key;
8585
*
8686
* flags |= COMPARE_VALUE;
@@ -244,9 +244,9 @@ void hashmap_free(struct hashmap *map, int free_entries);
244244
* your structure was allocated with xmalloc(), you can just free(3) it,
245245
* and if it is on stack, you can just let it go out of scope).
246246
*/
247-
static inline void hashmap_entry_init(void *entry, unsigned int hash)
247+
static inline void hashmap_entry_init(struct hashmap_entry *e,
248+
unsigned int hash)
248249
{
249-
struct hashmap_entry *e = entry;
250250
e->hash = hash;
251251
e->next = NULL;
252252
}

‎merge-recursive.c

+7-6
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ static struct dir_rename_entry *dir_rename_find_entry(struct hashmap *hashmap,
6161

6262
if (dir == NULL)
6363
return NULL;
64-
hashmap_entry_init(&key, strhash(dir));
64+
hashmap_entry_init(&key.ent, strhash(dir));
6565
key.dir = dir;
6666
return hashmap_get(hashmap, &key, NULL);
6767
}
@@ -85,7 +85,7 @@ static void dir_rename_init(struct hashmap *map)
8585
static void dir_rename_entry_init(struct dir_rename_entry *entry,
8686
char *directory)
8787
{
88-
hashmap_entry_init(entry, strhash(directory));
88+
hashmap_entry_init(&entry->ent, strhash(directory));
8989
entry->dir = directory;
9090
entry->non_unique_new_dir = 0;
9191
strbuf_init(&entry->new_dir, 0);
@@ -97,7 +97,7 @@ static struct collision_entry *collision_find_entry(struct hashmap *hashmap,
9797
{
9898
struct collision_entry key;
9999

100-
hashmap_entry_init(&key, strhash(target_file));
100+
hashmap_entry_init(&key.ent, strhash(target_file));
101101
key.target_file = target_file;
102102
return hashmap_get(hashmap, &key, NULL);
103103
}
@@ -454,7 +454,7 @@ static int save_files_dirs(const struct object_id *oid,
454454
strbuf_addstr(base, path);
455455

456456
FLEX_ALLOC_MEM(entry, path, base->buf, base->len);
457-
hashmap_entry_init(entry, path_hash(entry->path));
457+
hashmap_entry_init(&entry->e, path_hash(entry->path));
458458
hashmap_add(&opt->current_file_dir_set, entry);
459459

460460
strbuf_setlen(base, baselen);
@@ -731,7 +731,7 @@ static char *unique_path(struct merge_options *opt, const char *path, const char
731731
}
732732

733733
FLEX_ALLOC_MEM(entry, path, newpath.buf, newpath.len);
734-
hashmap_entry_init(entry, path_hash(entry->path));
734+
hashmap_entry_init(&entry->e, path_hash(entry->path));
735735
hashmap_add(&opt->current_file_dir_set, entry);
736736
return strbuf_detach(&newpath, NULL);
737737
}
@@ -2358,7 +2358,8 @@ static void compute_collisions(struct hashmap *collisions,
23582358
if (!collision_ent) {
23592359
collision_ent = xcalloc(1,
23602360
sizeof(struct collision_entry));
2361-
hashmap_entry_init(collision_ent, strhash(new_path));
2361+
hashmap_entry_init(&collision_ent->ent,
2362+
strhash(new_path));
23622363
hashmap_put(collisions, collision_ent);
23632364
collision_ent->target_file = new_path;
23642365
} else {

‎name-hash.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ static struct dir_entry *find_dir_entry__hash(struct index_state *istate,
3333
const char *name, unsigned int namelen, unsigned int hash)
3434
{
3535
struct dir_entry key;
36-
hashmap_entry_init(&key, hash);
36+
hashmap_entry_init(&key.ent, hash);
3737
key.namelen = namelen;
3838
return hashmap_get(&istate->dir_hash, &key, name);
3939
}
@@ -68,7 +68,7 @@ static struct dir_entry *hash_dir_entry(struct index_state *istate,
6868
if (!dir) {
6969
/* not found, create it and add to hash table */
7070
FLEX_ALLOC_MEM(dir, name, ce->name, namelen);
71-
hashmap_entry_init(dir, memihash(ce->name, namelen));
71+
hashmap_entry_init(&dir->ent, memihash(ce->name, namelen));
7272
dir->namelen = namelen;
7373
hashmap_add(&istate->dir_hash, dir);
7474

@@ -106,7 +106,7 @@ static void hash_index_entry(struct index_state *istate, struct cache_entry *ce)
106106
if (ce->ce_flags & CE_HASHED)
107107
return;
108108
ce->ce_flags |= CE_HASHED;
109-
hashmap_entry_init(ce, memihash(ce->name, ce_namelen(ce)));
109+
hashmap_entry_init(&ce->ent, memihash(ce->name, ce_namelen(ce)));
110110
hashmap_add(&istate->name_hash, ce);
111111

112112
if (ignore_case)
@@ -280,7 +280,7 @@ static struct dir_entry *hash_dir_entry_with_parent_and_prefix(
280280
dir = find_dir_entry__hash(istate, prefix->buf, prefix->len, hash);
281281
if (!dir) {
282282
FLEX_ALLOC_MEM(dir, name, prefix->buf, prefix->len);
283-
hashmap_entry_init(dir, hash);
283+
hashmap_entry_init(&dir->ent, hash);
284284
dir->namelen = prefix->len;
285285
dir->parent = parent;
286286
hashmap_add(&istate->dir_hash, dir);
@@ -472,7 +472,7 @@ static void *lazy_name_thread_proc(void *_data)
472472
for (k = 0; k < d->istate->cache_nr; k++) {
473473
struct cache_entry *ce_k = d->istate->cache[k];
474474
ce_k->ce_flags |= CE_HASHED;
475-
hashmap_entry_init(ce_k, d->lazy_entries[k].hash_name);
475+
hashmap_entry_init(&ce_k->ent, d->lazy_entries[k].hash_name);
476476
hashmap_add(&d->istate->name_hash, ce_k);
477477
}
478478

‎packfile.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1487,7 +1487,7 @@ static void add_delta_base_cache(struct packed_git *p, off_t base_offset,
14871487

14881488
if (!delta_base_cache.cmpfn)
14891489
hashmap_init(&delta_base_cache, delta_base_cache_hash_cmp, NULL, 0);
1490-
hashmap_entry_init(ent, pack_entry_hash(p, base_offset));
1490+
hashmap_entry_init(&ent->ent, pack_entry_hash(p, base_offset));
14911491
hashmap_add(&delta_base_cache, ent);
14921492
}
14931493

‎patch-ids.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ static int init_patch_id_entry(struct patch_id *patch,
8383
if (commit_patch_id(commit, &ids->diffopts, &header_only_patch_id, 1, 0))
8484
return -1;
8585

86-
hashmap_entry_init(patch, oidhash(&header_only_patch_id));
86+
hashmap_entry_init(&patch->ent, oidhash(&header_only_patch_id));
8787
return 0;
8888
}
8989

‎range-diff.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ static void find_exact_matches(struct string_list *a, struct string_list *b)
217217
util->i = i;
218218
util->patch = a->items[i].string;
219219
util->diff = util->patch + util->diff_offset;
220-
hashmap_entry_init(util, strhash(util->diff));
220+
hashmap_entry_init(&util->e, strhash(util->diff));
221221
hashmap_add(&map, util);
222222
}
223223

@@ -228,7 +228,7 @@ static void find_exact_matches(struct string_list *a, struct string_list *b)
228228
util->i = i;
229229
util->patch = b->items[i].string;
230230
util->diff = util->patch + util->diff_offset;
231-
hashmap_entry_init(util, strhash(util->diff));
231+
hashmap_entry_init(&util->e, strhash(util->diff));
232232
other = hashmap_remove(&map, util, NULL);
233233
if (other) {
234234
if (other->matching >= 0)

‎ref-filter.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -1565,7 +1565,8 @@ static void populate_worktree_map(struct hashmap *map, struct worktree **worktre
15651565
struct ref_to_worktree_entry *entry;
15661566
entry = xmalloc(sizeof(*entry));
15671567
entry->wt = worktrees[i];
1568-
hashmap_entry_init(entry, strhash(worktrees[i]->head_ref));
1568+
hashmap_entry_init(&entry->ent,
1569+
strhash(worktrees[i]->head_ref));
15691570

15701571
hashmap_add(map, entry);
15711572
}

‎refs.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1796,7 +1796,7 @@ static struct ref_store_hash_entry *alloc_ref_store_hash_entry(
17961796
struct ref_store_hash_entry *entry;
17971797

17981798
FLEX_ALLOC_STR(entry, name, name);
1799-
hashmap_entry_init(entry, strhash(name));
1799+
hashmap_entry_init(&entry->ent, strhash(name));
18001800
entry->refs = refs;
18011801
return entry;
18021802
}

‎remote.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ static struct remote *make_remote(const char *name, int len)
158158
ALLOC_GROW(remotes, remotes_nr + 1, remotes_alloc);
159159
remotes[remotes_nr++] = ret;
160160

161-
hashmap_entry_init(ret, lookup_entry.hash);
161+
hashmap_entry_init(&ret->ent, lookup_entry.hash);
162162
replaced = hashmap_put(&remotes_hash, ret);
163163
assert(replaced == NULL); /* no previous entry overwritten */
164164
return ret;

‎revision.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -141,15 +141,15 @@ static void paths_and_oids_insert(struct hashmap *map,
141141
struct path_and_oids_entry key;
142142
struct path_and_oids_entry *entry;
143143

144-
hashmap_entry_init(&key, hash);
144+
hashmap_entry_init(&key.ent, hash);
145145

146146
/* use a shallow copy for the lookup */
147147
key.path = (char *)path;
148148
oidset_init(&key.trees, 0);
149149

150150
if (!(entry = (struct path_and_oids_entry *)hashmap_get(map, &key, NULL))) {
151151
entry = xcalloc(1, sizeof(struct path_and_oids_entry));
152-
hashmap_entry_init(entry, hash);
152+
hashmap_entry_init(&entry->ent, hash);
153153
entry->path = xstrdup(key.path);
154154
oidset_init(&entry->trees, 16);
155155
hashmap_put(map, entry);

‎sequencer.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -4538,7 +4538,7 @@ static const char *label_oid(struct object_id *oid, const char *label,
45384538
}
45394539

45404540
FLEX_ALLOC_STR(labels_entry, label, label);
4541-
hashmap_entry_init(labels_entry, strihash(label));
4541+
hashmap_entry_init(&labels_entry->entry, strihash(label));
45424542
hashmap_add(&state->labels, labels_entry);
45434543

45444544
FLEX_ALLOC_STR(string_entry, string, label);
@@ -5252,7 +5252,8 @@ int todo_list_rearrange_squash(struct todo_list *todo_list)
52525252
strhash(subject), subject)) {
52535253
FLEX_ALLOC_MEM(entry, subject, subject, subject_len);
52545254
entry->i = i;
5255-
hashmap_entry_init(entry, strhash(entry->subject));
5255+
hashmap_entry_init(&entry->entry,
5256+
strhash(entry->subject));
52565257
hashmap_put(&subject2item, entry);
52575258
}
52585259
}

‎sub-process.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ struct subprocess_entry *subprocess_find_entry(struct hashmap *hashmap, const ch
2020
{
2121
struct subprocess_entry key;
2222

23-
hashmap_entry_init(&key, strhash(cmd));
23+
hashmap_entry_init(&key.ent, strhash(cmd));
2424
key.cmd = cmd;
2525
return hashmap_get(hashmap, &key, NULL);
2626
}
@@ -96,7 +96,7 @@ int subprocess_start(struct hashmap *hashmap, struct subprocess_entry *entry, co
9696
return err;
9797
}
9898

99-
hashmap_entry_init(entry, strhash(cmd));
99+
hashmap_entry_init(&entry->ent, strhash(cmd));
100100

101101
err = startfn(entry);
102102
if (err) {

‎submodule-config.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ static void cache_put_path(struct submodule_cache *cache,
123123
unsigned int hash = hash_oid_string(&submodule->gitmodules_oid,
124124
submodule->path);
125125
struct submodule_entry *e = xmalloc(sizeof(*e));
126-
hashmap_entry_init(e, hash);
126+
hashmap_entry_init(&e->ent, hash);
127127
e->config = submodule;
128128
hashmap_put(&cache->for_path, e);
129129
}
@@ -135,7 +135,7 @@ static void cache_remove_path(struct submodule_cache *cache,
135135
submodule->path);
136136
struct submodule_entry e;
137137
struct submodule_entry *removed;
138-
hashmap_entry_init(&e, hash);
138+
hashmap_entry_init(&e.ent, hash);
139139
e.config = submodule;
140140
removed = hashmap_remove(&cache->for_path, &e, NULL);
141141
free(removed);
@@ -147,7 +147,7 @@ static void cache_add(struct submodule_cache *cache,
147147
unsigned int hash = hash_oid_string(&submodule->gitmodules_oid,
148148
submodule->name);
149149
struct submodule_entry *e = xmalloc(sizeof(*e));
150-
hashmap_entry_init(e, hash);
150+
hashmap_entry_init(&e->ent, hash);
151151
e->config = submodule;
152152
hashmap_add(&cache->for_name, e);
153153
}
@@ -163,7 +163,7 @@ static const struct submodule *cache_lookup_path(struct submodule_cache *cache,
163163
oidcpy(&key_config.gitmodules_oid, gitmodules_oid);
164164
key_config.path = path;
165165

166-
hashmap_entry_init(&key, hash);
166+
hashmap_entry_init(&key.ent, hash);
167167
key.config = &key_config;
168168

169169
entry = hashmap_get(&cache->for_path, &key, NULL);
@@ -183,7 +183,7 @@ static struct submodule *cache_lookup_name(struct submodule_cache *cache,
183183
oidcpy(&key_config.gitmodules_oid, gitmodules_oid);
184184
key_config.name = name;
185185

186-
hashmap_entry_init(&key, hash);
186+
hashmap_entry_init(&key.ent, hash);
187187
key.config = &key_config;
188188

189189
entry = hashmap_get(&cache->for_name, &key, NULL);

‎t/helper/test-hashmap.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ static struct test_entry *alloc_test_entry(unsigned int hash,
3737
size_t klen = strlen(key);
3838
size_t vlen = strlen(value);
3939
struct test_entry *entry = xmalloc(st_add4(sizeof(*entry), klen, vlen, 2));
40-
hashmap_entry_init(entry, hash);
40+
hashmap_entry_init(&entry->ent, hash);
4141
memcpy(entry->key, key, klen + 1);
4242
memcpy(entry->key + klen + 1, value, vlen + 1);
4343
return entry;
@@ -103,7 +103,7 @@ static void perf_hashmap(unsigned int method, unsigned int rounds)
103103

104104
/* add entries */
105105
for (i = 0; i < TEST_SIZE; i++) {
106-
hashmap_entry_init(entries[i], hashes[i]);
106+
hashmap_entry_init(&entries[i]->ent, hashes[i]);
107107
hashmap_add(&map, entries[i]);
108108
}
109109

@@ -116,7 +116,7 @@ static void perf_hashmap(unsigned int method, unsigned int rounds)
116116
/* fill the map (sparsely if specified) */
117117
j = (method & TEST_SPARSE) ? TEST_SIZE / 10 : TEST_SIZE;
118118
for (i = 0; i < j; i++) {
119-
hashmap_entry_init(entries[i], hashes[i]);
119+
hashmap_entry_init(&entries[i]->ent, hashes[i]);
120120
hashmap_add(&map, entries[i]);
121121
}
122122

0 commit comments

Comments
 (0)
Please sign in to comment.