cocci: avoid self-references in object_id transformations
The object_id functions oid_to_hex, oid_to_hex_r, oidclr, oidcmp, and oidcpy are defined as wrappers of their legacy counterparts sha1_to_hex, sha1_to_hex_r, hashclr, hashcmp, and hashcpy, respectively. Make sure that the Coccinelle transformations for converting legacy function calls are not applied to these wrappers themselves, which would result in tautological declarations. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe committed
Nov 1, 2016 at 09:49 UTC
c2bb0c1d1e957ec1418fa6013c8c1e3e0ef38afa
1 file changed
+15
contrib/coccinelle/object_id.cocci
+15
@@ -17,10 +17,13 @@ expression E1;
17
+ oid_to_hex(&E1)
18
19
@@
20
+identifier f != oid_to_hex;
21
expression E1;
22
@@
23
+ f(...) {...
24
- sha1_to_hex(E1->hash)
25
+ oid_to_hex(E1)
26
+ ...}
27
28
@@
29
expression E1, E2;
@@ -29,10 +32,13 @@ expression E1, E2;
32
+ oid_to_hex_r(E1, &E2)
33
34
@@
35
+identifier f != oid_to_hex_r;
36
expression E1, E2;
37
@@
38
+ f(...) {...
39
- sha1_to_hex_r(E1, E2->hash)
40
+ oid_to_hex_r(E1, E2)
41
+ ...}
42
43
@@
44
expression E1;
@@ -41,10 +47,13 @@ expression E1;
47
+ oidclr(&E1)
48
49
@@
50
+identifier f != oidclr;
51
expression E1;
52
@@
53
+ f(...) {...
54
- hashclr(E1->hash)
55
+ oidclr(E1)
56
+ ...}
57
58
@@
59
expression E1, E2;
@@ -53,10 +62,13 @@ expression E1, E2;
62
+ oidcmp(&E1, &E2)
63
64
@@
65
+identifier f != oidcmp;
66
expression E1, E2;
67
@@
68
+ f(...) {...
69
- hashcmp(E1->hash, E2->hash)
70
+ oidcmp(E1, E2)
71
+ ...}
72
73
@@
74
expression E1, E2;
@@ -77,10 +89,13 @@ expression E1, E2;
89
+ oidcpy(&E1, &E2)
90
91
@@
92
+identifier f != oidcpy;
93
expression E1, E2;
94
@@
95
+ f(...) {...
96
- hashcpy(E1->hash, E2->hash)
97
+ oidcpy(E1, E2)
98
+ ...}
99
100
@@
101
expression E1, E2;