Merge branch 'jk/hashcmp-memcmp'
Code clean-up. * jk/hashcmp-memcmp: hashcmp: use memcmp instead of open-coded loop
This commit is contained in:
commit
e45bbfc584
9
cache.h
9
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)
|
static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2)
|
||||||
{
|
{
|
||||||
int i;
|
return memcmp(sha1, sha2, GIT_SHA1_RAWSZ);
|
||||||
|
|
||||||
for (i = 0; i < GIT_SHA1_RAWSZ; i++, sha1++, sha2++) {
|
|
||||||
if (*sha1 != *sha2)
|
|
||||||
return *sha1 - *sha2;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int oidcmp(const struct object_id *oid1, const struct object_id *oid2)
|
static inline int oidcmp(const struct object_id *oid1, const struct object_id *oid2)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user