test: Reuse the ARRAY_LENGTH() macro
authorAndrea Canciani <ranma42@gmail.com>
Thu, 3 Nov 2011 09:53:10 +0000 (10:53 +0100)
committerAndrea Canciani <ranma42@gmail.com>
Wed, 9 Nov 2011 08:17:00 +0000 (09:17 +0100)
It is provided by utils.h, there is no need to redefine it.

test/alphamap.c
test/scaling-crash-test.c

index 554b309..24a350e 100644 (file)
@@ -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)
 {
index 50d445d..ed57ae0 100644 (file)
@@ -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,