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 | #include "warn.h" | 36 | #include "warn.h" |
| 37 | 37 | ||
| 38 | #include <linux/hashtable.h> | 38 | #include <linux/hashtable.h> |
| 39 | 39 | #include <linux/kernel.h> | |
| 40 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) | ||
| 41 | 40 | ||
| 42 | #define STATE_FP_SAVED 0x1 | 41 | #define STATE_FP_SAVED 0x1 |
| 43 | #define STATE_FP_SETUP 0x2 | 42 | #define STATE_FP_SETUP 0x2 |
| @@ -31,11 +31,10 @@ · 30 unmodified lines | |||
| 31 | #include <stdlib.h> | 31 | #include <stdlib.h> |
| 32 | #include <subcmd/exec-cmd.h> | 32 | #include <subcmd/exec-cmd.h> |
| 33 | #include <subcmd/pager.h> | 33 | #include <subcmd/pager.h> |
| 34 | #include <linux/kernel.h> | ||
| 34 | 35 | ||
| 35 | #include "builtin.h" | 36 | #include "builtin.h" |
| 36 | 37 | ||
| 37 | #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) | ||
| 38 | |||
| 39 | struct cmd_struct { | 38 | struct cmd_struct { |
| 40 | const char *name; | 39 | const char *name; |
| 41 | int (*fn)(int, const char **); | 40 | int (*fn)(int, const char **); |