patch-ids.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
8d0017daa1dcd596a1412700aee378c27238319e
1 file changed
+9
-5
patch-ids.c
+9
-5
@@ -35,11 +35,16 @@ int commit_patch_id(struct commit *commit, struct diff_options *options,
35
* the side of safety. The actual value being negative does not have
36
* any significance; only that it is non-zero matters.
37
*/
38
-static int patch_id_cmp(struct diff_options *opt,
39
- struct patch_id *a,
40
- struct patch_id *b,
38
+static int patch_id_cmp(const void *cmpfn_data,
39
+ const void *entry,
40
+ const void *entry_or_key,
41
const void *unused_keydata)
42
{
43
+ /* NEEDSWORK: const correctness? */
44
+ struct diff_options *opt = (void *)cmpfn_data;
45
+ struct patch_id *a = (void *)entry;
46
+ struct patch_id *b = (void *)entry_or_key;
47
+
48
if (is_null_oid(&a->patch_id) &&
49
commit_patch_id(a->commit, opt, &a->patch_id, 0))
50
return error("Could not get patch ID for %s",
@@ -58,8 +63,7 @@ int init_patch_ids(struct patch_ids *ids)
63
ids->diffopts.detect_rename = 0;
64
DIFF_OPT_SET(&ids->diffopts, RECURSIVE);
65
diff_setup_done(&ids->diffopts);
61
- hashmap_init(&ids->patches, (hashmap_cmp_fn)patch_id_cmp,
62
- &ids->diffopts, 256);
66
+ hashmap_init(&ids->patches, patch_id_cmp, &ids->diffopts, 256);
67
return 0;
68
}
69