summaryrefslogtreecommitdiff
path: root/admin/coccinelle/arrayelts.cocci
blob: 9e1e0e64a9df0ecc39731c8bc455a3e7394ae1ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Use the countof macro where possible.
@@
type T;
T[] E;
@@
- (sizeof (E) / sizeof (E[...]))
+ countof (E)

@@
type T;
T[] E;
@@
- (sizeof (E) / sizeof (T))
+ countof (E)

@@
type T;
T[] E;
@@
- (sizeof (E) / sizeof (*E))
+ countof (E)