cache: make oidcpy always copy GIT_MAX_RAWSZ bytes
[git/debian.git] / contrib / coccinelle / object_id.cocci
blob3e536a9834b62353f984f04e0051e20aa5378f48
1 @@
2 struct object_id OID;
3 @@
4 - is_null_sha1(OID.hash)
5 + is_null_oid(&OID)
7 @@
8 struct object_id *OIDPTR;
9 @@
10 - is_null_sha1(OIDPTR->hash)
11 + is_null_oid(OIDPTR)
14 struct object_id OID;
16 - sha1_to_hex(OID.hash)
17 + oid_to_hex(&OID)
20 identifier f != oid_to_hex;
21 struct object_id *OIDPTR;
23   f(...) {<...
24 - sha1_to_hex(OIDPTR->hash)
25 + oid_to_hex(OIDPTR)
26   ...>}
29 expression E;
30 struct object_id OID;
32 - sha1_to_hex_r(E, OID.hash)
33 + oid_to_hex_r(E, &OID)
36 identifier f != oid_to_hex_r;
37 expression E;
38 struct object_id *OIDPTR;
40    f(...) {<...
41 - sha1_to_hex_r(E, OIDPTR->hash)
42 + oid_to_hex_r(E, OIDPTR)
43   ...>}
46 struct object_id OID;
48 - hashclr(OID.hash)
49 + oidclr(&OID)
52 identifier f != oidclr;
53 struct object_id *OIDPTR;
55   f(...) {<...
56 - hashclr(OIDPTR->hash)
57 + oidclr(OIDPTR)
58   ...>}
61 struct object_id OID1, OID2;
63 - hashcmp(OID1.hash, OID2.hash)
64 + oidcmp(&OID1, &OID2)
67 identifier f != oidcmp;
68 struct object_id *OIDPTR1, OIDPTR2;
70   f(...) {<...
71 - hashcmp(OIDPTR1->hash, OIDPTR2->hash)
72 + oidcmp(OIDPTR1, OIDPTR2)
73   ...>}
76 struct object_id *OIDPTR;
77 struct object_id OID;
79 - hashcmp(OIDPTR->hash, OID.hash)
80 + oidcmp(OIDPTR, &OID)
83 struct object_id *OIDPTR;
84 struct object_id OID;
86 - hashcmp(OID.hash, OIDPTR->hash)
87 + oidcmp(&OID, OIDPTR)
90 struct object_id *OIDPTR1;
91 struct object_id *OIDPTR2;
93 - oidcmp(OIDPTR1, OIDPTR2) == 0
94 + oideq(OIDPTR1, OIDPTR2)
97 identifier f != hasheq;
98 expression E1, E2;
100   f(...) {<...
101 - hashcmp(E1, E2) == 0
102 + hasheq(E1, E2)
103   ...>}
106 struct object_id *OIDPTR1;
107 struct object_id *OIDPTR2;
109 - oidcmp(OIDPTR1, OIDPTR2) != 0
110 + !oideq(OIDPTR1, OIDPTR2)
113 identifier f != hasheq;
114 expression E1, E2;
116   f(...) {<...
117 - hashcmp(E1, E2) != 0
118 + !hasheq(E1, E2)
119   ...>}