Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Merge branch 'jk/hashcmp-memcmp'
author
Junio C Hamano
<gitster@pobox.com>
Tue, 22 Aug 2017 17:29:09 +0000
(10:29 -0700)
committer
Junio C Hamano
<gitster@pobox.com>
Tue, 22 Aug 2017 17:29:09 +0000
(10:29 -0700)
Code clean-up.
* jk/hashcmp-memcmp:
hashcmp: use memcmp instead of open-coded loop
cache.h
patch
|
blob
|
history
raw
(from parent 1:
caa25f7
)
diff --git
a/cache.h
b/cache.h
index 3c44a25ffe9a703b25a99f978e5d6145fdad8d91..f99404f89ad1fa158b67cc671abad5968fdc1e98 100644
(file)
--- 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)