summaryrefslogtreecommitdiff
path: root/name-hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'name-hash.c')
-rw-r--r--name-hash.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/name-hash.c b/name-hash.c
index dbacb34..73b83ad 100644
--- a/name-hash.c
+++ b/name-hash.c
@@ -702,17 +702,16 @@ 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;
+ unsigned int hash = memihash(name, namelen);
lazy_init_name_hash(istate);
- ent = hashmap_get_from_hash(&istate->name_hash,
- memihash(name, namelen), NULL);
- while (ent) {
- ce = container_of(ent, struct cache_entry, ent);
+ ce = hashmap_get_entry_from_hash(&istate->name_hash, hash, NULL,
+ struct cache_entry, ent);
+ hashmap_for_each_entry_from(&istate->name_hash, ce,
+ struct cache_entry, ent) {
if (same_name(ce, name, namelen, icase))
return ce;
- ent = hashmap_get_next(&istate->name_hash, ent);
}
return NULL;
}