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>
This commit is contained in:

committed by
Junio C Hamano

parent
f23a465132
commit
939af16eac
14
oidmap.c
14
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)
|
||||
|
Reference in New Issue
Block a user