tools-common: make ARRAY_SIZE() a common macro
authorBartosz Golaszewski <bartekgola@gmail.com>
Tue, 17 Jan 2017 14:10:21 +0000 (15:10 +0100)
committerBartosz Golaszewski <bartekgola@gmail.com>
Tue, 17 Jan 2017 14:10:21 +0000 (15:10 +0100)
Move ARRAY_SIZE() out of gpioinfo.c and place it in tools-common.h.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
src/tools/gpioinfo.c
src/tools/tools-common.h

index 01d7817e05a82b178cbca33474ff3354a20abffd..5a570d26eb84529df55156606fcd29be1f35d61c 100644 (file)
@@ -17,8 +17,6 @@
 #include <getopt.h>
 #include <errno.h>
 
-#define ARRAY_SIZE(x)  (sizeof(x) / sizeof(*(x)))
-
 struct flag {
        const char *name;
        bool (*is_set)(struct gpiod_line *);
index 391c93b8be65acb34f7687040eb78e24dc6d5320..d3401d256d8a3c397690a1b545d74698391e0d8a 100644 (file)
@@ -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);