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
@ -38,24 +38,28 @@ enum lookup_type {
|
||||
};
|
||||
|
||||
static int config_path_cmp(const void *unused_cmp_data,
|
||||
const void *entry,
|
||||
const void *entry_or_key,
|
||||
const struct hashmap_entry *eptr,
|
||||
const struct hashmap_entry *entry_or_key,
|
||||
const void *unused_keydata)
|
||||
{
|
||||
const struct submodule_entry *a = entry;
|
||||
const struct submodule_entry *b = entry_or_key;
|
||||
const struct submodule_entry *a, *b;
|
||||
|
||||
a = container_of(eptr, const struct submodule_entry, ent);
|
||||
b = container_of(entry_or_key, const struct submodule_entry, ent);
|
||||
|
||||
return strcmp(a->config->path, b->config->path) ||
|
||||
!oideq(&a->config->gitmodules_oid, &b->config->gitmodules_oid);
|
||||
}
|
||||
|
||||
static int config_name_cmp(const void *unused_cmp_data,
|
||||
const void *entry,
|
||||
const void *entry_or_key,
|
||||
const struct hashmap_entry *eptr,
|
||||
const struct hashmap_entry *entry_or_key,
|
||||
const void *unused_keydata)
|
||||
{
|
||||
const struct submodule_entry *a = entry;
|
||||
const struct submodule_entry *b = entry_or_key;
|
||||
const struct submodule_entry *a, *b;
|
||||
|
||||
a = container_of(eptr, const struct submodule_entry, ent);
|
||||
b = container_of(entry_or_key, const struct submodule_entry, ent);
|
||||
|
||||
return strcmp(a->config->name, b->config->name) ||
|
||||
!oideq(&a->config->gitmodules_oid, &b->config->gitmodules_oid);
|
||||
|
||||
Reference in New Issue
Block a user