name-hash.c: drop hashmap_cmp_fn cast
Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Stefan Beller committed
Jun 30, 2017 at 17:28 UTC
56a14ea7acbc1b22e92b0ea8ea0b8ed5c7e4efc2
1 file changed
+13
-9
name-hash.c
+13
-9
@@ -17,10 +17,14 @@ struct dir_entry {
17
};
18
19
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)
23
{
24
+ const struct dir_entry *e1 = entry;
25
+ const struct dir_entry *e2 = entry_or_key;
26
+ const char *name = keydata;
27
+
28
return e1->namelen != e2->namelen || strncasecmp(e1->name,
29
name ? name : e2->name, e1->namelen);
30
}
@@ -110,10 +114,12 @@ static void hash_index_entry(struct index_state *istate, struct cache_entry *ce)
114
}
115
116
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,
119
const void *remove)
120
{
121
+ const struct cache_entry *ce1 = entry;
122
+ const struct cache_entry *ce2 = entry_or_key;
123
/*
124
* For remove_name_hash, find the exact entry (pointer equality); for
125
* 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)
580
{
581
if (istate->name_hash_initialized)
582
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);
585
586
if (lookup_lazy_params(istate)) {
587
hashmap_disallow_rehash(&istate->dir_hash, 1);