[Pixman] [PATCH 4/5] test: Reuse the ARRAY_LENGTH() macro

Andrea Canciani ranma42 at gmail.com
Fri Nov 4 05:23:28 PDT 2011


It is provided by utils.h, there is no need to redefine it.
---
 test/alphamap.c           |    2 --
 test/scaling-crash-test.c |    5 ++---
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/test/alphamap.c b/test/alphamap.c
index 554b309..24a350e 100644
--- a/test/alphamap.c
+++ b/test/alphamap.c
@@ -139,8 +139,6 @@ get_alpha (pixman_image_t *image, int x, int y, int orig_x, int orig_y)
     return r;
 }
 
-#define ARRAY_LENGTH(A) ((int) (sizeof (A) / sizeof ((A) [0])))
-
 static int
 run_test (int s, int d, int sa, int da, int soff, int doff)
 {
diff --git a/test/scaling-crash-test.c b/test/scaling-crash-test.c
index 50d445d..ed57ae0 100644
--- a/test/scaling-crash-test.c
+++ b/test/scaling-crash-test.c
@@ -130,12 +130,11 @@ do_test (int32_t		dst_size,
 	 int32_t		src_offs,
 	 int32_t		scale_factor)
 {
-#define N_ELEMENTS(a)	(sizeof (a) / sizeof ((a)[0]))
     int i, j;
 
-    for (i = 0; i < N_ELEMENTS(filters); ++i)
+    for (i = 0; i < ARRAY_LENGTH (filters); ++i)
     {
-	for (j = 0; j < N_ELEMENTS (repeats); ++j)
+	for (j = 0; j < ARRAY_LENGTH (repeats); ++j)
 	{
 	    /* horizontal test */
 	    if (run_test (dst_size, 1,
-- 
1.7.5.4



More information about the Pixman mailing list