Add a simple coccinelle patch for finding NELEM() candidates.
[dragonfly.git] / test / cocci / NELEM.cocci
... / ...
CommitLineData
1@param@
2@@
3
4#include <sys/param.h>
5
6@depends on param@
7type E;
8E[] T;
9@@
10
11- sizeof(T)/sizeof(E)
12+ NELEM(T)
13
14@depends on param@
15type E;
16E[] T;
17@@
18
19- sizeof(T)/sizeof(*T)
20+ NELEM(T)
21
22@depends on param@
23type E;
24E[] T;
25@@
26
27- sizeof(T)/sizeof(T[...])
28+ NELEM(T)