From: Bartosz Golaszewski Date: Tue, 17 Jan 2017 14:10:21 +0000 (+0100) Subject: tools-common: make ARRAY_SIZE() a common macro X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=5037e6f2f460ef239349fd605eb69a2673a41f97;p=qemu-gpiodev%2Flibgpiod.git tools-common: make ARRAY_SIZE() a common macro Move ARRAY_SIZE() out of gpioinfo.c and place it in tools-common.h. Signed-off-by: Bartosz Golaszewski --- diff --git a/src/tools/gpioinfo.c b/src/tools/gpioinfo.c index 01d7817..5a570d2 100644 --- a/src/tools/gpioinfo.c +++ b/src/tools/gpioinfo.c @@ -17,8 +17,6 @@ #include #include -#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x))) - struct flag { const char *name; bool (*is_set)(struct gpiod_line *); diff --git a/src/tools/tools-common.h b/src/tools/tools-common.h index 391c93b..d3401d2 100644 --- a/src/tools/tools-common.h +++ b/src/tools/tools-common.h @@ -20,6 +20,7 @@ #define UNUSED __attribute__((unused)) #define PRINTF(fmt, arg) __attribute__((format(printf, fmt, arg))) +#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x))) void set_progname(char *name); const char * get_progname(void);