mirror of
https://github.com/git/git.git
synced 2024-05-26 11:46:12 +02:00
9001dc2a74
This is the flip side of the previous two patches: checking for a non-zero oidcmp() can be more strictly expressed as inequality. Like those patches, we write "!= 0" in the coccinelle transformation, which covers by isomorphism the more common: if (oidcmp(E1, E2)) As with the previous two patches, this patch can be achieved almost entirely by running "make coccicheck"; the only differences are manual line-wrap fixes to match the original code. There is one thing to note for anybody replicating this, though: coccinelle 1.0.4 seems to miss the case in builtin/tag.c, even though it's basically the same as all the others. Running with 1.0.7 does catch this, so presumably it's just a coccinelle bug that was fixed in the interim. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
132 lines
1.6 KiB
Plaintext
132 lines
1.6 KiB
Plaintext
@@
|
|
expression E1;
|
|
@@
|
|
- is_null_sha1(E1.hash)
|
|
+ is_null_oid(&E1)
|
|
|
|
@@
|
|
expression E1;
|
|
@@
|
|
- is_null_sha1(E1->hash)
|
|
+ is_null_oid(E1)
|
|
|
|
@@
|
|
expression E1;
|
|
@@
|
|
- sha1_to_hex(E1.hash)
|
|
+ oid_to_hex(&E1)
|
|
|
|
@@
|
|
identifier f != oid_to_hex;
|
|
expression E1;
|
|
@@
|
|
f(...) {<...
|
|
- sha1_to_hex(E1->hash)
|
|
+ oid_to_hex(E1)
|
|
...>}
|
|
|
|
@@
|
|
expression E1, E2;
|
|
@@
|
|
- sha1_to_hex_r(E1, E2.hash)
|
|
+ oid_to_hex_r(E1, &E2)
|
|
|
|
@@
|
|
identifier f != oid_to_hex_r;
|
|
expression E1, E2;
|
|
@@
|
|
f(...) {<...
|
|
- sha1_to_hex_r(E1, E2->hash)
|
|
+ oid_to_hex_r(E1, E2)
|
|
...>}
|
|
|
|
@@
|
|
expression E1;
|
|
@@
|
|
- hashclr(E1.hash)
|
|
+ oidclr(&E1)
|
|
|
|
@@
|
|
identifier f != oidclr;
|
|
expression E1;
|
|
@@
|
|
f(...) {<...
|
|
- hashclr(E1->hash)
|
|
+ oidclr(E1)
|
|
...>}
|
|
|
|
@@
|
|
expression E1, E2;
|
|
@@
|
|
- hashcmp(E1.hash, E2.hash)
|
|
+ oidcmp(&E1, &E2)
|
|
|
|
@@
|
|
identifier f != oidcmp;
|
|
expression E1, E2;
|
|
@@
|
|
f(...) {<...
|
|
- hashcmp(E1->hash, E2->hash)
|
|
+ oidcmp(E1, E2)
|
|
...>}
|
|
|
|
@@
|
|
expression E1, E2;
|
|
@@
|
|
- hashcmp(E1->hash, E2.hash)
|
|
+ oidcmp(E1, &E2)
|
|
|
|
@@
|
|
expression E1, E2;
|
|
@@
|
|
- hashcmp(E1.hash, E2->hash)
|
|
+ oidcmp(&E1, E2)
|
|
|
|
@@
|
|
expression E1, E2;
|
|
@@
|
|
- hashcpy(E1.hash, E2.hash)
|
|
+ oidcpy(&E1, &E2)
|
|
|
|
@@
|
|
identifier f != oidcpy;
|
|
expression E1, E2;
|
|
@@
|
|
f(...) {<...
|
|
- hashcpy(E1->hash, E2->hash)
|
|
+ oidcpy(E1, E2)
|
|
...>}
|
|
|
|
@@
|
|
expression E1, E2;
|
|
@@
|
|
- hashcpy(E1->hash, E2.hash)
|
|
+ oidcpy(E1, &E2)
|
|
|
|
@@
|
|
expression E1, E2;
|
|
@@
|
|
- hashcpy(E1.hash, E2->hash)
|
|
+ oidcpy(&E1, E2)
|
|
|
|
@@
|
|
expression E1, E2;
|
|
@@
|
|
- oidcmp(E1, E2) == 0
|
|
+ oideq(E1, E2)
|
|
|
|
@@
|
|
identifier f != hasheq;
|
|
expression E1, E2;
|
|
@@
|
|
f(...) {<...
|
|
- hashcmp(E1, E2) == 0
|
|
+ hasheq(E1, E2)
|
|
...>}
|
|
|
|
@@
|
|
expression E1, E2;
|
|
@@
|
|
- oidcmp(E1, E2) != 0
|
|
+ !oideq(E1, E2)
|