And with the goodies present in the kernel.h counterpart, i.e. checking that the parameter is an array at build time.
Unified · Split
| @@ -36,8 +36,7 @@ · 35 unmodified lines | ||
| 36 | 36 | #include "warn.h" |
| 37 | 37 | |
| 38 | 38 | #include <linux/hashtable.h> |
| 39 | − | |
| 40 | −#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) | |
| 39 | +#include <linux/kernel.h> | |
| 41 | 40 | |
| 42 | 41 | #define STATE_FP_SAVED 0x1 |
| 43 | 42 | #define STATE_FP_SETUP 0x2 |
| @@ -31,11 +31,10 @@ · 30 unmodified lines | ||
| 31 | 31 | #include <stdlib.h> |
| 32 | 32 | #include <subcmd/exec-cmd.h> |
| 33 | 33 | #include <subcmd/pager.h> |
| 34 | +#include <linux/kernel.h> | |
| 34 | 35 | |
| 35 | 36 | #include "builtin.h" |
| 36 | 37 | |
| 37 | −#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) | |
| 38 | − | |
| 39 | 38 | struct cmd_struct { |
| 40 | 39 | const char *name; |
| 41 | 40 | int (*fn)(int, const char **); |