OSDN Git Service

name-hash.c: replace cache_name_compare() with memcmp(3)
authorJeremiah Mahler <jmmahler@gmail.com>
Fri, 20 Jun 2014 02:06:43 +0000 (19:06 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 20 Jun 2014 17:08:10 +0000 (10:08 -0700)
The same_name() private function wants a quick-and-exact check to
see if they two names are byte-for-byte identical first and then
fall back to the slow path.  Use memcmp(3) for the former to make it
clear that we do not want any "name" specific comparison.

Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
name-hash.c

index 97444d0..49fd508 100644 (file)
@@ -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)