From: Jeremiah Mahler <jmmahler@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jonathan Nieder <jrnieder@gmail.com>,
git@vger.kernel.org, Jeremiah Mahler <jmmahler@gmail.com>
Subject: [PATCH v5 1/2] name-hash.c: replace cache_name_compare() with memcmp()
Date: Thu, 19 Jun 2014 19:06:43 -0700 [thread overview]
Message-ID: <1403230004-11034-2-git-send-email-jmmahler@gmail.com> (raw)
In-Reply-To: <1403230004-11034-1-git-send-email-jmmahler@gmail.com>
When cache_name_compare() is used on counted strings of the same
length, it is equivalent to a memcmp(). Since the one use of
cache_name_compare() in name-hash.c requires that the lengths are
equal, just replace it with memcmp().
Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com>
---
name-hash.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/name-hash.c b/name-hash.c
index be7c4ae..63cc188 100644
--- a/name-hash.c
+++ b/name-hash.c
@@ -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)
--
2.0.0.694.g5736dad
next prev parent reply other threads:[~2014-06-20 2:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-20 2:06 [PATCH v5 0/2] cleanup duplicate name_compare() functions Jeremiah Mahler
2014-06-20 2:06 ` Jeremiah Mahler [this message]
2014-06-20 17:10 ` [PATCH v5 1/2] name-hash.c: replace cache_name_compare() with memcmp() Junio C Hamano
2014-06-20 2:06 ` [PATCH v5 2/2] cleanup duplicate name_compare() functions Jeremiah Mahler
2014-06-20 17:15 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1403230004-11034-2-git-send-email-jmmahler@gmail.com \
--to=jmmahler@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).