summaryrefslogtreecommitdiffstats
path: root/dev/coccinelle/xalloc_size.cocci
blob: 80808e3d7a9e450dce344693b4063dc7fe9bc883 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
@@
type T;
expression E;
expression t;
@@

(
  t = calloc(E, sizeof(*t))
|
- t = calloc(E, sizeof(T))
+ t = calloc(E, sizeof(*t))
)

@@
type T;
T *x;
@@

  x = malloc(
- sizeof(T)
+ sizeof(*x)
  )

@@
type T;
T *x;
@@

  x = calloc(1,
- sizeof(T)
+ sizeof(*x)
  )

@@
@@

  calloc(
+ 1,
  ...
- ,1
  )