Merge branch 'jk/ref-filter-segfault-fix'
[git] / contrib / coccinelle / object_id.cocci
1 @@
2 struct object_id OID;
3 @@
4 - is_null_sha1(OID.hash)
5 + is_null_oid(&OID)
6
7 @@
8 struct object_id *OIDPTR;
9 @@
10 - is_null_sha1(OIDPTR->hash)
11 + is_null_oid(OIDPTR)
12
13 @@
14 struct object_id OID;
15 @@
16 - hashclr(OID.hash)
17 + oidclr(&OID)
18
19 @@
20 identifier f != oidclr;
21 struct object_id *OIDPTR;
22 @@
23   f(...) {<...
24 - hashclr(OIDPTR->hash)
25 + oidclr(OIDPTR)
26   ...>}
27
28 @@
29 struct object_id OID1, OID2;
30 @@
31 - hashcmp(OID1.hash, OID2.hash)
32 + oidcmp(&OID1, &OID2)
33
34 @@
35 identifier f != oidcmp;
36 struct object_id *OIDPTR1, OIDPTR2;
37 @@
38   f(...) {<...
39 - hashcmp(OIDPTR1->hash, OIDPTR2->hash)
40 + oidcmp(OIDPTR1, OIDPTR2)
41   ...>}
42
43 @@
44 struct object_id *OIDPTR;
45 struct object_id OID;
46 @@
47 - hashcmp(OIDPTR->hash, OID.hash)
48 + oidcmp(OIDPTR, &OID)
49
50 @@
51 struct object_id *OIDPTR;
52 struct object_id OID;
53 @@
54 - hashcmp(OID.hash, OIDPTR->hash)
55 + oidcmp(&OID, OIDPTR)
56
57 @@
58 struct object_id *OIDPTR1;
59 struct object_id *OIDPTR2;
60 @@
61 - oidcmp(OIDPTR1, OIDPTR2) == 0
62 + oideq(OIDPTR1, OIDPTR2)
63
64 @@
65 identifier f != hasheq;
66 expression E1, E2;
67 @@
68   f(...) {<...
69 - hashcmp(E1, E2) == 0
70 + hasheq(E1, E2)
71   ...>}
72
73 @@
74 struct object_id *OIDPTR1;
75 struct object_id *OIDPTR2;
76 @@
77 - oidcmp(OIDPTR1, OIDPTR2) != 0
78 + !oideq(OIDPTR1, OIDPTR2)
79
80 @@
81 identifier f != hasheq;
82 expression E1, E2;
83 @@
84   f(...) {<...
85 - hashcmp(E1, E2) != 0
86 + !hasheq(E1, E2)
87   ...>}