diff options
author | Eric Wong <e@80x24.org> | 2019-10-07 01:30:37 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-10-07 03:20:11 +0200 |
commit | 939af16eac1608766273d3971598dbcc4fe09928 (patch) | |
tree | 15abb229ccf6464acd1241fac3db0c45ee7b6bbd /revision.c | |
parent | hashmap_get{,_from_hash} return "struct hashmap_entry *" (diff) | |
download | git-939af16eac1608766273d3971598dbcc4fe09928.tar.xz git-939af16eac1608766273d3971598dbcc4fe09928.zip |
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.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/revision.c b/revision.c index d5f534209d..f32fbc5e2e 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) |