gpiod.h: remove GPIOD_ARRAY_SIZE()
authorBartosz Golaszewski <bartekgola@gmail.com>
Mon, 2 Jan 2017 14:02:50 +0000 (15:02 +0100)
committerBartosz Golaszewski <bartekgola@gmail.com>
Mon, 2 Jan 2017 14:02:50 +0000 (15:02 +0100)
This macro is only used by gpioinfo and is not relevant for the GPIO
API. Remove it from gpiod.h and define it directly in gpioinfo.c.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
gpiod.h
gpioinfo.c

diff --git a/gpiod.h b/gpiod.h
index d7b451dbc4988f5c262152b8e80075acb31cf9a8..fa9215a86978244fb0b2982a9817820829f77fbd 100644 (file)
--- a/gpiod.h
+++ b/gpiod.h
@@ -30,8 +30,6 @@ extern "C" {
 
 #define GPIOD_API              __attribute__((visibility("default")))
 
-#define GPIOD_ARRAY_SIZE(x)    (sizeof(x) / sizeof(*(x)))
-
 #define GPIOD_BIT(nr)          (1UL << (nr))
 
 int gpiod_errno(void) GPIOD_API;
index 57ded125cbfa8e10b0eafe31dd85e4be4905ea77..9ca0ecc4c9039f2a7ff0194648c7f60dd3e90e3a 100644 (file)
@@ -15,6 +15,8 @@
 
 /* REVISIT This program needs a nicer, better formatted output. */
 
+#define ARRAY_SIZE(x)  (sizeof(x) / sizeof(*(x)))
+
 struct flag {
        const char *name;
        bool (*is_set)(struct gpiod_line *);
@@ -85,7 +87,7 @@ int main(int argc, char **argv)
                                                 : "active-high");
 
                        flag_printed = false;
-                       for (j = 0; j < GPIOD_ARRAY_SIZE(flags); j++) {
+                       for (j = 0; j < ARRAY_SIZE(flags); j++) {
                                if (flags[j].is_set(line)) {
                                        if (flag_printed)
                                                printf(" ");