git/contrib/coccinelle/object_id.cocci
Jeff King 67947c34ae convert "hashcmp() != 0" to "!hasheq()"
This rounds out the previous three patches, covering the
inequality logic for the "hash" variant of the functions.

As with the previous three, the accompanying code changes
are the mechanical result of applying the coccinelle patch;
see those patches for more discussion.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-08-29 11:32:49 -07:00

141 lines
1.7 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)
@@
identifier f != hasheq;
expression E1, E2;
@@
f(...) {<...
- hashcmp(E1, E2) != 0
+ !hasheq(E1, E2)
...>}