summaryrefslogtreecommitdiff
path: root/remote.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-08-11 20:27:01 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-08-11 20:27:01 (GMT)
commit55c965f3a27b3a36f84c56b6eba8ac5c95ff558a (patch)
treed893a0f0244d84125b40cd29eb45125b6cd0c0f5 /remote.c
parent3ab01ac3f7681a294a09b42b9b014dc48a9aee22 (diff)
parent6815d1143150f422fe2ad1a7ddcc6205bef006ae (diff)
downloadgit-55c965f3a27b3a36f84c56b6eba8ac5c95ff558a.zip
git-55c965f3a27b3a36f84c56b6eba8ac5c95ff558a.tar.gz
git-55c965f3a27b3a36f84c56b6eba8ac5c95ff558a.tar.bz2
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 'remote.c')
-rw-r--r--remote.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/remote.c b/remote.c
index 6a1be31..43c317e 100644
--- a/remote.c
+++ b/remote.c
@@ -134,10 +134,14 @@ struct remotes_hash_key {
};
static int remotes_hash_cmp(const void *unused_cmp_data,
- const struct remote *a,
- const struct remote *b,
- const struct remotes_hash_key *key)
+ const void *entry,
+ const void *entry_or_key,
+ const void *keydata)
{
+ const struct remote *a = entry;
+ const struct remote *b = entry_or_key;
+ const struct remotes_hash_key *key = keydata;
+
if (key)
return strncmp(a->name, key->str, key->len) || a->name[key->len];
else
@@ -147,7 +151,7 @@ static int remotes_hash_cmp(const void *unused_cmp_data,
static inline void init_remotes_hash(void)
{
if (!remotes_hash.cmpfn)
- hashmap_init(&remotes_hash, (hashmap_cmp_fn)remotes_hash_cmp, NULL, 0);
+ hashmap_init(&remotes_hash, remotes_hash_cmp, NULL, 0);
}
static struct remote *make_remote(const char *name, int len)