summaryrefslogtreecommitdiff
path: root/submodule-config.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-07-13 23:14:54 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-07-13 23:14:54 (GMT)
commit91f69225443b3be8d3f11c5c71795169d7d00737 (patch)
tree7c891653d8fb17dfb29641cc8e56385064816e94 /submodule-config.c
parenteac97b438c6734304c155604f4c36ac63f29ca6f (diff)
parent1ecbf31d0298a1ed952623108e23234d5cf37086 (diff)
downloadgit-91f69225443b3be8d3f11c5c71795169d7d00737.zip
git-91f69225443b3be8d3f11c5c71795169d7d00737.tar.gz
git-91f69225443b3be8d3f11c5c71795169d7d00737.tar.bz2
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 37cfcce..eeb154a 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;
}