]> git.ipfire.org Git - thirdparty/git.git/blob - contrib/coccinelle/object_id.cocci
Sync with maint
[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 *OIDPTR1;
91 struct object_id *OIDPTR2;
92 @@
93 - oidcmp(OIDPTR1, OIDPTR2) == 0
94 + oideq(OIDPTR1, OIDPTR2)
95
96 @@
97 identifier f != hasheq;
98 expression E1, E2;
99 @@
100 f(...) {<...
101 - hashcmp(E1, E2) == 0
102 + hasheq(E1, E2)
103 ...>}
104
105 @@
106 struct object_id *OIDPTR1;
107 struct object_id *OIDPTR2;
108 @@
109 - oidcmp(OIDPTR1, OIDPTR2) != 0
110 + !oideq(OIDPTR1, OIDPTR2)
111
112 @@
113 identifier f != hasheq;
114 expression E1, E2;
115 @@
116 f(...) {<...
117 - hashcmp(E1, E2) != 0
118 + !hasheq(E1, E2)
119 ...>}