Git 2.44
[git/gitster.git] / contrib / coccinelle / object_id.cocci
blob01f8d6935b203feebeb421d2899622bce25a2f02
1 @@
2 struct object_id OID;
3 @@
4 - hashclr(OID.hash)
5 + oidclr(&OID)
7 @@
8 identifier f != oidclr;
9 struct object_id *OIDPTR;
11   f(...) {<...
12 - hashclr(OIDPTR->hash)
13 + oidclr(OIDPTR)
14   ...>}
17 struct object_id OID1, OID2;
19 - hashcmp(OID1.hash, OID2.hash)
20 + oidcmp(&OID1, &OID2)
23 identifier f != oidcmp;
24 struct object_id *OIDPTR1, OIDPTR2;
26   f(...) {<...
27 - hashcmp(OIDPTR1->hash, OIDPTR2->hash)
28 + oidcmp(OIDPTR1, OIDPTR2)
29   ...>}
32 struct object_id *OIDPTR;
33 struct object_id OID;
35 - hashcmp(OIDPTR->hash, OID.hash)
36 + oidcmp(OIDPTR, &OID)
39 struct object_id *OIDPTR;
40 struct object_id OID;
42 - hashcmp(OID.hash, OIDPTR->hash)
43 + oidcmp(&OID, OIDPTR)
46 struct object_id *OIDPTR1;
47 struct object_id *OIDPTR2;
49 - oidcmp(OIDPTR1, OIDPTR2) == 0
50 + oideq(OIDPTR1, OIDPTR2)
53 identifier f != hasheq;
54 expression E1, E2;
56   f(...) {<...
57 - hashcmp(E1, E2) == 0
58 + hasheq(E1, E2)
59   ...>}
62 struct object_id *OIDPTR1;
63 struct object_id *OIDPTR2;
65 - oidcmp(OIDPTR1, OIDPTR2) != 0
66 + !oideq(OIDPTR1, OIDPTR2)
69 identifier f != hasheq;
70 expression E1, E2;
72   f(...) {<...
73 - hashcmp(E1, E2) != 0
74 + !hasheq(E1, E2)
75   ...>}