aboutsummaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-08-22 10:29:09 -0700
committerJunio C Hamano <gitster@pobox.com>2017-08-22 10:29:09 -0700
commite45bbfc584afbef6b8a00eddbe17dc99d4c6c426 (patch)
tree42d8789a3e5561ba622baa4b3b348f67dc715040 /cache.h
parentcaa25f75be9ee085332208c5c1fe13644e9f0b34 (diff)
parent0b006014c87f400bd9a86267ed30fd3e7b383884 (diff)
downloadgit-e45bbfc584afbef6b8a00eddbe17dc99d4c6c426.tar.gz
git-e45bbfc584afbef6b8a00eddbe17dc99d4c6c426.tar.xz
Merge branch 'jk/hashcmp-memcmp'
Code clean-up. * jk/hashcmp-memcmp: hashcmp: use memcmp instead of open-coded loop
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h9
1 files changed, 1 insertions, 8 deletions
diff --git a/cache.h b/cache.h
index 3c44a25ff..f99404f89 100644
--- a/cache.h
+++ b/cache.h
@@ -939,14 +939,7 @@ extern const struct object_id null_oid;
static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2)
{
- int i;
-
- for (i = 0; i < GIT_SHA1_RAWSZ; i++, sha1++, sha2++) {
- if (*sha1 != *sha2)
- return *sha1 - *sha2;
- }
-
- return 0;
+ return memcmp(sha1, sha2, GIT_SHA1_RAWSZ);
}
static inline int oidcmp(const struct object_id *oid1, const struct object_id *oid2)