aboutsummaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-08-11 13:27:01 -0700
committerJunio C Hamano <gitster@pobox.com>2017-08-11 13:27:01 -0700
commit55c965f3a27b3a36f84c56b6eba8ac5c95ff558a (patch)
treed893a0f0244d84125b40cd29eb45125b6cd0c0f5 /config.c
parent3ab01ac3f7681a294a09b42b9b014dc48a9aee22 (diff)
parent6815d1143150f422fe2ad1a7ddcc6205bef006ae (diff)
downloadgit-55c965f3a27b3a36f84c56b6eba8ac5c95ff558a.tar.gz
git-55c965f3a27b3a36f84c56b6eba8ac5c95ff558a.tar.xz
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 'config.c')
-rw-r--r--config.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/config.c b/config.c
index e04500d13..9ec8c4488 100644
--- a/config.c
+++ b/config.c
@@ -1719,17 +1719,19 @@ static int configset_add_value(struct config_set *cs, const char *key, const cha
}
static int config_set_element_cmp(const void *unused_cmp_data,
- const struct config_set_element *e1,
- const struct config_set_element *e2,
+ const void *entry,
+ const void *entry_or_key,
const void *unused_keydata)
{
+ const struct config_set_element *e1 = entry;
+ const struct config_set_element *e2 = entry_or_key;
+
return strcmp(e1->key, e2->key);
}
void git_configset_init(struct config_set *cs)
{
- hashmap_init(&cs->config_hash, (hashmap_cmp_fn)config_set_element_cmp,
- NULL, 0);
+ hashmap_init(&cs->config_hash, config_set_element_cmp, NULL, 0);
cs->hash_initialized = 1;
cs->list.nr = 0;
cs->list.alloc = 0;