summaryrefslogtreecommitdiff
path: root/oidmap.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 /oidmap.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 'oidmap.c')
-rw-r--r--oidmap.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/oidmap.c b/oidmap.c
index cd22b3a..4942599 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)