ident.c: add support for IPv6
[gitweb.git] / name-hash.c
index 9a3bd3f9a629e2cd37dfb1277ccb9ae190c947c8..702cd0518fca67a84417de8268ed70dfa29392e4 100644 (file)
@@ -115,7 +115,7 @@ static int cache_entry_cmp(const struct cache_entry *ce1,
 {
        /*
         * For remove_name_hash, find the exact entry (pointer equality); for
-        * index_name_exists, find all entries with matching hash code and
+        * index_file_exists, find all entries with matching hash code and
         * decide whether the entry matches in same_name.
         */
        return remove ? !(ce1 == ce2) : 0;
@@ -179,7 +179,7 @@ static int same_name(const struct cache_entry *ce, const char *name, int namelen
         * Always do exact compare, even if we want a case-ignoring comparison;
         * we do the quick exact one first, because it will be the common case.
         */
-       if (len == namelen && !cache_name_compare(name, namelen, ce->name, len))
+       if (len == namelen && !memcmp(name, ce->name, len))
                return 1;
 
        if (!icase)
@@ -213,12 +213,11 @@ struct cache_entry *index_dir_exists(struct index_state *istate, const char *nam
 struct cache_entry *index_file_exists(struct index_state *istate, const char *name, int namelen, int icase)
 {
        struct cache_entry *ce;
-       struct hashmap_entry key;
 
        lazy_init_name_hash(istate);
 
-       hashmap_entry_init(&key, memihash(name, namelen));
-       ce = hashmap_get(&istate->name_hash, &key, NULL);
+       ce = hashmap_get_from_hash(&istate->name_hash,
+                                  memihash(name, namelen), NULL);
        while (ce) {
                if (same_name(ce, name, namelen, icase))
                        return ce;
@@ -227,13 +226,6 @@ struct cache_entry *index_file_exists(struct index_state *istate, const char *na
        return NULL;
 }
 
-struct cache_entry *index_name_exists(struct index_state *istate, const char *name, int namelen, int icase)
-{
-       if (namelen > 0 && name[namelen - 1] == '/')
-               return index_dir_exists(istate, name, namelen - 1);
-       return index_file_exists(istate, name, namelen, icase);
-}
-
 void free_name_hash(struct index_state *istate)
 {
        if (!istate->name_hash_initialized)