summaryrefslogtreecommitdiff
path: root/submodule-config.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2017-07-13 16:14:54 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-07-13 16:14:54 -0700
commit91f69225443b3be8d3f11c5c71795169d7d00737 (patch)
tree7c891653d8fb17dfb29641cc8e56385064816e94 /submodule-config.c
parentMerge branch 'ab/grep-lose-opt-regflags' (diff)
parenthashmap: migrate documentation from Documentation/technical into header (diff)
downloadtgif-91f69225443b3be8d3f11c5c71795169d7d00737.tar.xz
Merge branch 'sb/hashmap-customize-comparison'
Update the hashmap API so that data to customize the behaviour of the comparison function can be specified at the time a hashmap is initialized. * sb/hashmap-customize-comparison: hashmap: migrate documentation from Documentation/technical into header patch-ids.c: use hashmap correctly hashmap.h: compare function has access to a data field
Diffstat (limited to 'submodule-config.c')
-rw-r--r--submodule-config.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/submodule-config.c b/submodule-config.c
index 37cfcceb95..eeb154a894 100644
--- a/submodule-config.c
+++ b/submodule-config.c
@@ -33,17 +33,19 @@ enum lookup_type {
lookup_path
};
-static int config_path_cmp(const struct submodule_entry *a,
+static int config_path_cmp(const void *unused_cmp_data,
+ const struct submodule_entry *a,
const struct submodule_entry *b,
- const void *unused)
+ const void *unused_keydata)
{
return strcmp(a->config->path, b->config->path) ||
hashcmp(a->config->gitmodules_sha1, b->config->gitmodules_sha1);
}
-static int config_name_cmp(const struct submodule_entry *a,
+static int config_name_cmp(const void *unused_cmp_data,
+ const struct submodule_entry *a,
const struct submodule_entry *b,
- const void *unused)
+ const void *unused_keydata)
{
return strcmp(a->config->name, b->config->name) ||
hashcmp(a->config->gitmodules_sha1, b->config->gitmodules_sha1);
@@ -56,8 +58,8 @@ static struct submodule_cache *submodule_cache_alloc(void)
static void submodule_cache_init(struct submodule_cache *cache)
{
- hashmap_init(&cache->for_path, (hashmap_cmp_fn) config_path_cmp, 0);
- hashmap_init(&cache->for_name, (hashmap_cmp_fn) config_name_cmp, 0);
+ hashmap_init(&cache->for_path, (hashmap_cmp_fn) config_path_cmp, NULL, 0);
+ hashmap_init(&cache->for_name, (hashmap_cmp_fn) config_name_cmp, NULL, 0);
cache->initialized = 1;
}