From d7695667f3b6dd2e50e1e100f7cbebd71fe92e0d Mon Sep 17 00:00:00 2001 From: Olivier Matz Date: Sun, 23 Feb 2020 23:37:07 +0100 Subject: [PATCH] move ec_count_of in utils.h --- include/ecoli_config.h | 5 ----- include/ecoli_strvec.h | 5 ----- include/ecoli_utils.h | 6 ++++++ 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/include/ecoli_config.h b/include/ecoli_config.h index ba93337..8ae15ed 100644 --- a/include/ecoli_config.h +++ b/include/ecoli_config.h @@ -17,11 +17,6 @@ #include #include -#ifndef EC_COUNT_OF //XXX -#define EC_COUNT_OF(x) ((sizeof(x)/sizeof(0[x])) / \ - ((size_t)(!(sizeof(x) % sizeof(0[x]))))) -#endif - struct ec_config; struct ec_dict; diff --git a/include/ecoli_strvec.h b/include/ecoli_strvec.h index 2464a2b..ee793e7 100644 --- a/include/ecoli_strvec.h +++ b/include/ecoli_strvec.h @@ -26,11 +26,6 @@ */ struct ec_strvec *ec_strvec(void); -#ifndef EC_COUNT_OF -#define EC_COUNT_OF(x) ((sizeof(x)/sizeof(0[x])) / \ - ((size_t)(!(sizeof(x) % sizeof(0[x]))))) -#endif - /** * Allocate a new string vector * diff --git a/include/ecoli_utils.h b/include/ecoli_utils.h index 7b76c17..7d6afcb 100644 --- a/include/ecoli_utils.h +++ b/include/ecoli_utils.h @@ -26,6 +26,12 @@ */ #define EC_VA_END ((void *)1) +/** + * Count number of elements in an array. + */ +#define EC_COUNT_OF(x) ((sizeof(x)/sizeof(0[x])) / \ + ((size_t)(!(sizeof(x) % sizeof(0[x]))))) + #endif /** @} */ -- 2.39.5