Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2018-08-29 00:22:44 +0300
committerJunio C Hamano <gitster@pobox.com>2018-08-29 21:32:49 +0300
commite3ff0683e22070ce42c3c373f6e89e9dc38b756c (patch)
treecf66b2e24d19b147c0bf10bab25ae4222978a2ab /cache.h
parent4a7e27e95797c0a094f8ee300a260777ddd7eec9 (diff)
convert "hashcmp() == 0" to hasheq()
This is the partner patch to the previous one, but covering the "hash" variants instead of "oid". Note that our coccinelle rule is slightly more complex to avoid triggering the call in hasheq(). I didn't bother to add a new rule to convert: - hasheq(E1->hash, E2->hash) + oideq(E1, E2) Since these are new functions, there won't be any such existing callers. And since most of the code is already using oideq, we're not likely to introduce new ones. We might still see "!hashcmp(E1->hash, E2->hash)" from topics in flight. But because our new rule comes after the existing ones, that should first get converted to "!oidcmp(E1, E2)" and then to "oideq(E1, E2)". Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/cache.h b/cache.h
index d090f71706..d97db26bb6 100644
--- a/cache.h
+++ b/cache.h
@@ -1053,12 +1053,12 @@ static inline int oideq(const struct object_id *oid1, const struct object_id *oi
static inline int is_null_sha1(const unsigned char *sha1)
{
- return !hashcmp(sha1, null_sha1);
+ return hasheq(sha1, null_sha1);
}
static inline int is_null_oid(const struct object_id *oid)
{
- return !hashcmp(oid->hash, null_sha1);
+ return hasheq(oid->hash, null_sha1);
}
static inline void hashcpy(unsigned char *sha_dst, const unsigned char *sha_src)
@@ -1095,7 +1095,7 @@ static inline void oidread(struct object_id *oid, const unsigned char *hash)
static inline int is_empty_blob_sha1(const unsigned char *sha1)
{
- return !hashcmp(sha1, the_hash_algo->empty_blob->hash);
+ return hasheq(sha1, the_hash_algo->empty_blob->hash);
}
static inline int is_empty_blob_oid(const struct object_id *oid)
@@ -1105,7 +1105,7 @@ static inline int is_empty_blob_oid(const struct object_id *oid)
static inline int is_empty_tree_sha1(const unsigned char *sha1)
{
- return !hashcmp(sha1, the_hash_algo->empty_tree->hash);
+ return hasheq(sha1, the_hash_algo->empty_tree->hash);
}
static inline int is_empty_tree_oid(const struct object_id *oid)