Release coccinelle-0.1
[bpt/coccinelle.git] / tests / memset.cocci
1 // have to duplicate a lot of rules because T E only matches if E has a known
2 // type, even if T is not used elsewhere.
3
4 @@
5 type T, T2;
6 expression x;
7 expression E1,E2,E;
8 @@
9
10 - x = (T)kmalloc(E1,E2)
11 ... when != x = E
12 - memset((T2)x,0,E1);
13
14 @@
15 type T, T2;
16 type T1;
17 T1 *x;
18 expression E2,E;
19 @@
20
21 - x = (T)kmalloc(sizeof(T1),E2)
22 ... when != x = E
23 - memset((T2)x,0,sizeof(*x));
24
25 @@
26 type T, T2;
27 type T1;
28 T1 *x;
29 expression E2,E;
30 @@
31
32 - x = (T)kmalloc(sizeof(*x),E2)
33 ... when != x = E
34 - memset((T2)x,0,sizeof(T1));
35
36 // ---------------------------------------------------------------------
37
38
39 @@
40 type T, T1, T2;
41 identifier x;
42 expression E1,E2,E;
43 @@
44
45 - T1 x = (T)kmalloc(E1,E2);
46 ... when != x = E
47 - memset((T2)x,0,E1);
48
49 @@
50 type T, T2;
51 type T1;
52 identifier x;
53 expression E2,E;
54 @@
55
56 - T1 x = (T)kmalloc(sizeof(T1),E2);
57 ... when != x = E
58 - memset((T2)x,0,sizeof(*x));
59
60 @@
61 type T, T2;
62 type T1;
63 identifier x;
64 expression E2,E;
65 @@
66
67 - T1 x = (T)kmalloc(sizeof(*x),E2);
68 ... when != x = E
69 - memset((T2)x,0,sizeof(T1));