diff options
-rw-r--r-- | tools/iio/iio_utils.c | 2 | ||||
-rw-r--r-- | tools/iio/iio_utils.h | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c index 4a7e4801cebf..e177f4022d40 100644 --- a/tools/iio/iio_utils.c +++ b/tools/iio/iio_utils.c @@ -39,7 +39,7 @@ int iioutils_break_up_name(const char *full_name, char **generic_name) char *working, *prefix = ""; int i, ret; - for (i = 0; i < sizeof(iio_direction) / sizeof(iio_direction[0]); i++) + for (i = 0; i < ARRAY_SIZE(iio_direction); i++) if (!strncmp(full_name, iio_direction[i], strlen(iio_direction[i]))) { prefix = iio_direction[i]; diff --git a/tools/iio/iio_utils.h b/tools/iio/iio_utils.h index 086610139ade..f30a1091b53e 100644 --- a/tools/iio/iio_utils.h +++ b/tools/iio/iio_utils.h @@ -18,6 +18,8 @@ #define FORMAT_SCAN_ELEMENTS_DIR "%s/scan_elements" #define FORMAT_TYPE_FILE "%s_type" +#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) + extern const char *iio_dir; /** |