From df6f99c655ad0daa50e4ba77f11fd64c36861b7f Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Mon, 2 Jan 2017 15:02:50 +0100 Subject: [PATCH] gpiod.h: remove GPIOD_ARRAY_SIZE() 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 --- gpiod.h | 2 -- gpioinfo.c | 4 +++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gpiod.h b/gpiod.h index d7b451d..fa9215a 100644 --- 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; diff --git a/gpioinfo.c b/gpioinfo.c index 57ded12..9ca0ecc 100644 --- a/gpioinfo.c +++ b/gpioinfo.c @@ -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(" "); -- 2.30.2