<div dir="ltr"><div>IMO it'd be good to add guards (#ifndef ARRAY_LENGTH) around this macro,<br>because it is used extensively in wayland/weston and in the future it may happen that<br>it'll be redefined by some included header.<br><br></div>Reviewed-by: Marek Chalupa <<a href="mailto:mchqwerty@gmail.com">mchqwerty@gmail.com</a>><br></div><div class="gmail_extra"><br><div class="gmail_quote">On 20 November 2014 at 02:18, Bryce Harrington <span dir="ltr"><<a href="mailto:bryce@osg.samsung.com" target="_blank">bryce@osg.samsung.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Signed-off-by: Bryce Harrington <<a href="mailto:bryce@osg.samsung.com">bryce@osg.samsung.com</a>><br>
---<br>
tests/presentation-test.c | 2 --<br>
tests/weston-test-runner.h | 4 +++-<br>
2 files changed, 3 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/tests/presentation-test.c b/tests/presentation-test.c<br>
index b99e93d..f97e5b3 100644<br>
--- a/tests/presentation-test.c<br>
+++ b/tests/presentation-test.c<br>
@@ -31,8 +31,6 @@<br>
#include "weston-test-client-helper.h"<br>
#include "presentation_timing-client-protocol.h"<br>
<br>
-#define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0])<br>
-<br>
static inline void *<br>
xzalloc(size_t size)<br>
{<br>
diff --git a/tests/weston-test-runner.h b/tests/weston-test-runner.h<br>
index e1db040..193b76d 100644<br>
--- a/tests/weston-test-runner.h<br>
+++ b/tests/weston-test-runner.h<br>
@@ -41,6 +41,8 @@ struct weston_test {<br>
int must_fail;<br>
} __attribute__ ((aligned (32)));<br>
<br>
+#define ARRAY_LENGTH(a) ((int) (sizeof (a) / sizeof (a)[0]))<br>
+<br>
#define TEST_BEGIN(name, arg) \<br>
static void name(arg)<br>
<br>
@@ -67,7 +69,7 @@ struct weston_test {<br>
#define ARG_TEST(name, ret, test_data) \<br>
TEST_COMMON(name, name, ret, test_data, \<br>
sizeof(test_data[0]), \<br>
- sizeof(test_data) / sizeof (test_data[0])) \<br>
+ ARRAY_LENGTH(test_data)) \<br>
TEST_BEGIN(name, void *data) \<br>
<br>
#define TEST(name) NO_ARG_TEST(name, 0)<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.9.1<br>
<br>
_______________________________________________<br>
wayland-devel mailing list<br>
<a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
</font></span></blockquote></div><br></div>