hashmap_get_next returns "struct hashmap_entry *"

This is a step towards removing the requirement for
hashmap_entry being the first field 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:
Eric Wong
2019-10-06 23:30:34 +00:00
committed by Junio C Hamano
parent 973d5eea74
commit 6bcbdfb277
6 changed files with 39 additions and 23 deletions

View File

@ -702,15 +702,17 @@ void adjust_dirname_case(struct index_state *istate, char *name)
struct cache_entry *index_file_exists(struct index_state *istate, const char *name, int namelen, int icase)
{
struct cache_entry *ce;
struct hashmap_entry *ent;
lazy_init_name_hash(istate);
ce = hashmap_get_from_hash(&istate->name_hash,
ent = hashmap_get_from_hash(&istate->name_hash,
memihash(name, namelen), NULL);
while (ce) {
while (ent) {
ce = container_of(ent, struct cache_entry, ent);
if (same_name(ce, name, namelen, icase))
return ce;
ce = hashmap_get_next(&istate->name_hash, &ce->ent);
ent = hashmap_get_next(&istate->name_hash, ent);
}
return NULL;
}