Skip to content

Commit 56a14ea

Browse files
stefanbellergitster
authored andcommitted
name-hash.c: drop hashmap_cmp_fn cast
Signed-off-by: Stefan Beller <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 152cbdc commit 56a14ea

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

name-hash.c

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@ struct dir_entry {
1717
};
1818

1919
static int dir_entry_cmp(const void *unused_cmp_data,
20-
const struct dir_entry *e1,
21-
const struct dir_entry *e2,
22-
const char *name)
20+
const void *entry,
21+
const void *entry_or_key,
22+
const void *keydata)
2323
{
24+
const struct dir_entry *e1 = entry;
25+
const struct dir_entry *e2 = entry_or_key;
26+
const char *name = keydata;
27+
2428
return e1->namelen != e2->namelen || strncasecmp(e1->name,
2529
name ? name : e2->name, e1->namelen);
2630
}
@@ -110,10 +114,12 @@ static void hash_index_entry(struct index_state *istate, struct cache_entry *ce)
110114
}
111115

112116
static int cache_entry_cmp(const void *unused_cmp_data,
113-
const struct cache_entry *ce1,
114-
const struct cache_entry *ce2,
117+
const void *entry,
118+
const void *entry_or_key,
115119
const void *remove)
116120
{
121+
const struct cache_entry *ce1 = entry;
122+
const struct cache_entry *ce2 = entry_or_key;
117123
/*
118124
* For remove_name_hash, find the exact entry (pointer equality); for
119125
* index_file_exists, find all entries with matching hash code and
@@ -574,10 +580,8 @@ static void lazy_init_name_hash(struct index_state *istate)
574580
{
575581
if (istate->name_hash_initialized)
576582
return;
577-
hashmap_init(&istate->name_hash, (hashmap_cmp_fn) cache_entry_cmp,
578-
NULL, istate->cache_nr);
579-
hashmap_init(&istate->dir_hash, (hashmap_cmp_fn) dir_entry_cmp,
580-
NULL, istate->cache_nr);
583+
hashmap_init(&istate->name_hash, cache_entry_cmp, NULL, istate->cache_nr);
584+
hashmap_init(&istate->dir_hash, dir_entry_cmp, NULL, istate->cache_nr);
581585

582586
if (lookup_lazy_params(istate)) {
583587
hashmap_disallow_rehash(&istate->dir_hash, 1);

0 commit comments

Comments
 (0)