Skip to content

Commit 7db316b

Browse files
stefanbellergitster
authored andcommitted
builtin/difftool.c: drop hashmap_cmp_fn cast
Signed-off-by: Stefan Beller <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 201c14e commit 7db316b

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

builtin/difftool.c

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,12 @@ struct working_tree_entry {
131131
};
132132

133133
static int working_tree_entry_cmp(const void *unused_cmp_data,
134-
struct working_tree_entry *a,
135-
struct working_tree_entry *b,
136-
void *unused_keydata)
134+
const void *entry,
135+
const void *entry_or_key,
136+
const void *unused_keydata)
137137
{
138+
const struct working_tree_entry *a = entry;
139+
const struct working_tree_entry *b = entry_or_key;
138140
return strcmp(a->path, b->path);
139141
}
140142

@@ -149,9 +151,13 @@ struct pair_entry {
149151
};
150152

151153
static int pair_cmp(const void *unused_cmp_data,
152-
struct pair_entry *a, struct pair_entry *b,
153-
void *unused_keydata)
154+
const void *entry,
155+
const void *entry_or_key,
156+
const void *unused_keydata)
154157
{
158+
const struct pair_entry *a = entry;
159+
const struct pair_entry *b = entry_or_key;
160+
155161
return strcmp(a->path, b->path);
156162
}
157163

@@ -179,9 +185,13 @@ struct path_entry {
179185
};
180186

181187
static int path_entry_cmp(const void *unused_cmp_data,
182-
struct path_entry *a, struct path_entry *b,
183-
void *key)
188+
const void *entry,
189+
const void *entry_or_key,
190+
const void *key)
184191
{
192+
const struct path_entry *a = entry;
193+
const struct path_entry *b = entry_or_key;
194+
185195
return strcmp(a->path, key ? key : b->path);
186196
}
187197

@@ -372,10 +382,9 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix,
372382
rdir_len = rdir.len;
373383
wtdir_len = wtdir.len;
374384

375-
hashmap_init(&working_tree_dups,
376-
(hashmap_cmp_fn)working_tree_entry_cmp, NULL, 0);
377-
hashmap_init(&submodules, (hashmap_cmp_fn)pair_cmp, NULL, 0);
378-
hashmap_init(&symlinks2, (hashmap_cmp_fn)pair_cmp, NULL, 0);
385+
hashmap_init(&working_tree_dups, working_tree_entry_cmp, NULL, 0);
386+
hashmap_init(&submodules, pair_cmp, NULL, 0);
387+
hashmap_init(&symlinks2, pair_cmp, NULL, 0);
379388

380389
child.no_stdin = 1;
381390
child.git_cmd = 1;
@@ -585,10 +594,8 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix,
585594
* in the common case of --symlinks and the difftool updating
586595
* files through the symlink.
587596
*/
588-
hashmap_init(&wt_modified, (hashmap_cmp_fn)path_entry_cmp,
589-
NULL, wtindex.cache_nr);
590-
hashmap_init(&tmp_modified, (hashmap_cmp_fn)path_entry_cmp,
591-
NULL, wtindex.cache_nr);
597+
hashmap_init(&wt_modified, path_entry_cmp, NULL, wtindex.cache_nr);
598+
hashmap_init(&tmp_modified, path_entry_cmp, NULL, wtindex.cache_nr);
592599

593600
for (i = 0; i < wtindex.cache_nr; i++) {
594601
struct hashmap_entry dummy;

0 commit comments

Comments
 (0)