Skip to content

Commit

Permalink
name-hash.c: replace cache_name_compare() with memcmp(3)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jeremiah Mahler authored and Junio C Hamano committed Jun 20, 2014
1 parent cb682f8 commit be99ec9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion name-hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit be99ec9

Please sign in to comment.