path: root/builtin/describe.c
diff options
authorJunio C Hamano <>2017-08-11 20:27:01 (GMT)
committerJunio C Hamano <>2017-08-11 20:27:01 (GMT)
commit55c965f3a27b3a36f84c56b6eba8ac5c95ff558a (patch)
treed893a0f0244d84125b40cd29eb45125b6cd0c0f5 /builtin/describe.c
parent3ab01ac3f7681a294a09b42b9b014dc48a9aee22 (diff)
parent6815d1143150f422fe2ad1a7ddcc6205bef006ae (diff)
Merge branch 'sb/hashmap-cleanup'
Many uses of comparision callback function the hashmap API uses cast the callback function type when registering it to hashmap_init(), which defeats the compile time type checking when the callback interface changes (e.g. gaining more parameters). The callback implementations have been updated to take "void *" pointers and cast them to the type they expect instead. * sb/hashmap-cleanup: t/helper/test-hashmap: use custom data instead of duplicate cmp functions name-hash.c: drop hashmap_cmp_fn cast submodule-config.c: drop hashmap_cmp_fn cast remote.c: drop hashmap_cmp_fn cast patch-ids.c: drop hashmap_cmp_fn cast convert/sub-process: drop cast to hashmap_cmp_fn config.c: drop hashmap_cmp_fn cast builtin/describe: drop hashmap_cmp_fn cast builtin/difftool.c: drop hashmap_cmp_fn cast attr.c: drop hashmap_cmp_fn cast
Diffstat (limited to 'builtin/describe.c')
1 files changed, 6 insertions, 3 deletions
diff --git a/builtin/describe.c b/builtin/describe.c
index 89ea1cd..9c13c68 100644
--- a/builtin/describe.c
+++ b/builtin/describe.c
@@ -55,10 +55,13 @@ static const char *prio_names[] = {
static int commit_name_cmp(const void *unused_cmp_data,
- const struct commit_name *cn1,
- const struct commit_name *cn2,
+ const void *entry,
+ const void *entry_or_key,
const void *peeled)
+ const struct commit_name *cn1 = entry;
+ const struct commit_name *cn2 = entry_or_key;
return oidcmp(&cn1->peeled, peeled ? peeled : &cn2->peeled);
@@ -503,7 +506,7 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
return cmd_name_rev(args.argc, args.argv, prefix);
- hashmap_init(&names, (hashmap_cmp_fn) commit_name_cmp, NULL, 0);
+ hashmap_init(&names, commit_name_cmp, NULL, 0);
for_each_rawref(get_name, NULL);
if (!names.size && !always)
die(_("No names found, cannot describe anything."));