summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-09-10 17:02:59 +0900
committerJunio C Hamano <gitster@pobox.com>2017-09-10 17:02:59 +0900
commit822a4d41785829c67f6cd19e9e5f8541eb4c3c11 (patch)
treef7d45e117b3baaae641973845fd7ffb941b5002b
parentf35a1d75b5ecefaef7b1a8ec55543c82883df82f (diff)
parent0b006014c87f400bd9a86267ed30fd3e7b383884 (diff)
downloadgit-822a4d41785829c67f6cd19e9e5f8541eb4c3c11.tar.gz
Merge branch 'jk/hashcmp-memcmp' into maint
Code clean-up. * jk/hashcmp-memcmp: hashcmp: use memcmp instead of open-coded loop
-rw-r--r--cache.h9
1 files changed, 1 insertions, 8 deletions
diff --git a/cache.h b/cache.h
index 25c98b6809..ee2db602bc 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)