From 939af16eac1608766273d3971598dbcc4fe09928 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 6 Oct 2019 23:30:37 +0000 Subject: 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 Reviewed-by: Derrick Stolee Signed-off-by: Junio C Hamano --- oidmap.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'oidmap.c') diff --git a/oidmap.c b/oidmap.c index cd22b3a8bf..4942599391 100644 --- a/oidmap.c +++ b/oidmap.c @@ -2,14 +2,18 @@ #include "oidmap.h" static int oidmap_neq(const void *hashmap_cmp_fn_data, - const void *entry, const void *entry_or_key, + const struct hashmap_entry *e1, + const struct hashmap_entry *e2, const void *keydata) { - const struct oidmap_entry *entry_ = entry; + const struct oidmap_entry *a, *b; + + a = container_of(e1, const struct oidmap_entry, internal_entry); + b = container_of(e2, const struct oidmap_entry, internal_entry); + if (keydata) - return !oideq(&entry_->oid, (const struct object_id *) keydata); - return !oideq(&entry_->oid, - &((const struct oidmap_entry *) entry_or_key)->oid); + return !oideq(&a->oid, (const struct object_id *) keydata); + return !oideq(&a->oid, &b->oid); } void oidmap_init(struct oidmap *map, size_t initial_size) -- cgit v1.2.3