[PATCH 3/4] tests: Move ARRAY_LENGTH to a shared header for reuse

Bryce Harrington bryce at osg.samsung.com
Wed Nov 19 17:18:35 PST 2014


Signed-off-by: Bryce Harrington <bryce at osg.samsung.com>
---
 tests/presentation-test.c  | 2 --
 tests/weston-test-runner.h | 4 +++-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/presentation-test.c b/tests/presentation-test.c
index b99e93d..f97e5b3 100644
--- a/tests/presentation-test.c
+++ b/tests/presentation-test.c
@@ -31,8 +31,6 @@
 #include "weston-test-client-helper.h"
 #include "presentation_timing-client-protocol.h"
 
-#define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0])
-
 static inline void *
 xzalloc(size_t size)
 {
diff --git a/tests/weston-test-runner.h b/tests/weston-test-runner.h
index e1db040..193b76d 100644
--- a/tests/weston-test-runner.h
+++ b/tests/weston-test-runner.h
@@ -41,6 +41,8 @@ struct weston_test {
 	int must_fail;
 } __attribute__ ((aligned (32)));
 
+#define ARRAY_LENGTH(a) ((int) (sizeof (a) / sizeof (a)[0]))
+
 #define TEST_BEGIN(name, arg)					\
 	static void name(arg)
 
@@ -67,7 +69,7 @@ struct weston_test {
 #define ARG_TEST(name, ret, test_data)				\
 	TEST_COMMON(name, name, ret, test_data,			\
 		    sizeof(test_data[0]),			\
-		    sizeof(test_data) / sizeof (test_data[0]))	\
+		    ARRAY_LENGTH(test_data))			\
 	TEST_BEGIN(name, void *data)				\
 
 #define TEST(name) NO_ARG_TEST(name, 0)
-- 
1.9.1



More information about the wayland-devel mailing list