summaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-10-06 23:30:37 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-10-07 01:20:11 (GMT)
commit939af16eac1608766273d3971598dbcc4fe09928 (patch)
tree15abb229ccf6464acd1241fac3db0c45ee7b6bbd /revision.c
parentf23a465132a22860684ac66052cf9a954a18e27d (diff)
downloadgit-939af16eac1608766273d3971598dbcc4fe09928.zip
git-939af16eac1608766273d3971598dbcc4fe09928.tar.gz
git-939af16eac1608766273d3971598dbcc4fe09928.tar.bz2
hashmap_cmp_fn takes hashmap_entry params
Another step in eliminating the requirement of hashmap_entry being the first member of a struct. Signed-off-by: Eric Wong <e@80x24.org> Reviewed-by: Derrick Stolee <stolee@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/revision.c b/revision.c
index d5f5342..f32fbc5 100644
--- a/revision.c
+++ b/revision.c
@@ -107,16 +107,21 @@ struct path_and_oids_entry {
};
static int path_and_oids_cmp(const void *hashmap_cmp_fn_data,
- const struct path_and_oids_entry *e1,
- const struct path_and_oids_entry *e2,
+ const struct hashmap_entry *eptr,
+ const struct hashmap_entry *entry_or_key,
const void *keydata)
{
+ const struct path_and_oids_entry *e1, *e2;
+
+ e1 = container_of(eptr, const struct path_and_oids_entry, ent);
+ e2 = container_of(entry_or_key, const struct path_and_oids_entry, ent);
+
return strcmp(e1->path, e2->path);
}
static void paths_and_oids_init(struct hashmap *map)
{
- hashmap_init(map, (hashmap_cmp_fn) path_and_oids_cmp, NULL, 0);
+ hashmap_init(map, path_and_oids_cmp, NULL, 0);
}
static void paths_and_oids_clear(struct hashmap *map)