Commit | Line | Data |
---|---|---|
1 | // | |
2 | // Find cases where NELEM() can be used. | |
3 | // | |
4 | // Applies to userland and kernel code. | |
5 | // | |
6 | ||
7 | @param@ | |
8 | @@ | |
9 | ||
10 | #include <sys/param.h> | |
11 | ||
12 | @depends on param@ | |
13 | type E; | |
14 | E[] T; | |
15 | @@ | |
16 | ||
17 | - sizeof(T)/sizeof(E) | |
18 | + NELEM(T) | |
19 | ||
20 | @depends on param@ | |
21 | type E; | |
22 | E[] T; | |
23 | @@ | |
24 | ||
25 | - sizeof(T)/sizeof(*T) | |
26 | + NELEM(T) | |
27 | ||
28 | @depends on param@ | |
29 | type E; | |
30 | E[] T; | |
31 | @@ | |
32 | ||
33 | - sizeof(T)/sizeof(T[...]) | |
34 | + NELEM(T) |