diff options
author | Jeff King <peff@peff.net> | 2018-08-28 17:22:44 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-08-29 11:32:49 -0700 |
commit | e3ff0683e22070ce42c3c373f6e89e9dc38b756c (patch) | |
tree | cf66b2e24d19b147c0bf10bab25ae4222978a2ab /contrib | |
parent | convert "oidcmp() == 0" to oideq() (diff) | |
download | tgif-e3ff0683e22070ce42c3c373f6e89e9dc38b756c.tar.xz |
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 'contrib')
-rw-r--r-- | contrib/coccinelle/object_id.cocci | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/contrib/coccinelle/object_id.cocci b/contrib/coccinelle/object_id.cocci index 548c02336d..d90ba8a040 100644 --- a/contrib/coccinelle/object_id.cocci +++ b/contrib/coccinelle/object_id.cocci @@ -114,3 +114,12 @@ expression E1, E2; @@ - oidcmp(E1, E2) == 0 + oideq(E1, E2) + +@@ +identifier f != hasheq; +expression E1, E2; +@@ + f(...) {<... +- hashcmp(E1, E2) == 0 ++ hasheq(E1, E2) + ...>} |