From 5037e6f2f460ef239349fd605eb69a2673a41f97 Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Tue, 17 Jan 2017 15:10:21 +0100 Subject: [PATCH] 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 --- src/tools/gpioinfo.c | 2 -- src/tools/tools-common.h | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) 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); -- 2.30.2