]> git.ipfire.org Git - thirdparty/git.git/blob - contrib/coccinelle/object_id.cocci
Merge branch 'ma/sequencer-do-reset-saner-loop-termination'
[thirdparty/git.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 - sha1_to_hex(OID.hash)
17 + oid_to_hex(&OID)
18
19 @@
20 identifier f != oid_to_hex;
21 struct object_id *OIDPTR;
22 @@
23 f(...) {<...
24 - sha1_to_hex(OIDPTR->hash)
25 + oid_to_hex(OIDPTR)
26 ...>}
27
28 @@
29 expression E;
30 struct object_id OID;
31 @@
32 - sha1_to_hex_r(E, OID.hash)
33 + oid_to_hex_r(E, &OID)
34
35 @@
36 identifier f != oid_to_hex_r;
37 expression E;
38 struct object_id *OIDPTR;
39 @@
40 f(...) {<...
41 - sha1_to_hex_r(E, OIDPTR->hash)
42 + oid_to_hex_r(E, OIDPTR)
43 ...>}
44
45 @@
46 struct object_id OID;
47 @@
48 - hashclr(OID.hash)
49 + oidclr(&OID)
50
51 @@
52 identifier f != oidclr;
53 struct object_id *OIDPTR;
54 @@
55 f(...) {<...
56 - hashclr(OIDPTR->hash)
57 + oidclr(OIDPTR)
58 ...>}
59
60 @@
61 struct object_id OID1, OID2;
62 @@
63 - hashcmp(OID1.hash, OID2.hash)
64 + oidcmp(&OID1, &OID2)
65
66 @@
67 identifier f != oidcmp;
68 struct object_id *OIDPTR1, OIDPTR2;
69 @@
70 f(...) {<...
71 - hashcmp(OIDPTR1->hash, OIDPTR2->hash)
72 + oidcmp(OIDPTR1, OIDPTR2)
73 ...>}
74
75 @@
76 struct object_id *OIDPTR;
77 struct object_id OID;
78 @@
79 - hashcmp(OIDPTR->hash, OID.hash)
80 + oidcmp(OIDPTR, &OID)
81
82 @@
83 struct object_id *OIDPTR;
84 struct object_id OID;
85 @@
86 - hashcmp(OID.hash, OIDPTR->hash)
87 + oidcmp(&OID, OIDPTR)
88
89 @@
90 struct object_id OID1, OID2;
91 @@
92 - hashcpy(OID1.hash, OID2.hash)
93 + oidcpy(&OID1, &OID2)
94
95 @@
96 identifier f != oidcpy;
97 struct object_id *OIDPTR1;
98 struct object_id *OIDPTR2;
99 @@
100 f(...) {<...
101 - hashcpy(OIDPTR1->hash, OIDPTR2->hash)
102 + oidcpy(OIDPTR1, OIDPTR2)
103 ...>}
104
105 @@
106 struct object_id *OIDPTR;
107 struct object_id OID;
108 @@
109 - hashcpy(OIDPTR->hash, OID.hash)
110 + oidcpy(OIDPTR, &OID)
111
112 @@
113 struct object_id *OIDPTR;
114 struct object_id OID;
115 @@
116 - hashcpy(OID.hash, OIDPTR->hash)
117 + oidcpy(&OID, OIDPTR)
118
119 @@
120 struct object_id *OIDPTR1;
121 struct object_id *OIDPTR2;
122 @@
123 - oidcmp(OIDPTR1, OIDPTR2) == 0
124 + oideq(OIDPTR1, OIDPTR2)
125
126 @@
127 identifier f != hasheq;
128 expression E1, E2;
129 @@
130 f(...) {<...
131 - hashcmp(E1, E2) == 0
132 + hasheq(E1, E2)
133 ...>}
134
135 @@
136 struct object_id *OIDPTR1;
137 struct object_id *OIDPTR2;
138 @@
139 - oidcmp(OIDPTR1, OIDPTR2) != 0
140 + !oideq(OIDPTR1, OIDPTR2)
141
142 @@
143 identifier f != hasheq;
144 expression E1, E2;
145 @@
146 f(...) {<...
147 - hashcmp(E1, E2) != 0
148 + !hasheq(E1, E2)
149 ...>}