summaryrefslogtreecommitdiff
path: root/test/operator-clear.c
diff options
context:
space:
mode:
authorAndrea Canciani <ranma42@gmail.com>2011-03-16 16:48:18 +0100
committerAndrea Canciani <ranma42@gmail.com>2011-03-17 17:45:57 +0100
commit75fea162d985bea622afa59771fb2d07f5241d1b (patch)
tree5876692cd2ba574481210fae292eaf7f06005028 /test/operator-clear.c
parent4ef32a36ba1e457e8dd6244a6483866d33477aac (diff)
test: Cleanup macros
The ARRAY_LENGTH macro is used by many tests, although sometimes it is named ARRAY_SIZE. Define it just once in cairo-test.h and reuse it. In a similar way, MAX() and MIN() are currently defined in some specific tests, while they could be reused.
Diffstat (limited to 'test/operator-clear.c')
-rw-r--r--test/operator-clear.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/test/operator-clear.c b/test/operator-clear.c
index a1cf9810..aac39f3d 100644
--- a/test/operator-clear.c
+++ b/test/operator-clear.c
@@ -138,9 +138,8 @@ static void (* const draw_funcs[])(cairo_t *cr, int x, int y) = {
draw_rects
};
-#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
-#define IMAGE_WIDTH (ARRAY_SIZE (pattern_funcs) * (WIDTH + PAD) + PAD)
-#define IMAGE_HEIGHT (ARRAY_SIZE (draw_funcs) * (HEIGHT + PAD) + PAD)
+#define IMAGE_WIDTH (ARRAY_LENGTH (pattern_funcs) * (WIDTH + PAD) + PAD)
+#define IMAGE_HEIGHT (ARRAY_LENGTH (draw_funcs) * (HEIGHT + PAD) + PAD)
static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
@@ -153,8 +152,8 @@ draw (cairo_t *cr, int width, int height)
CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_NORMAL);
- for (j = 0; j < ARRAY_SIZE (draw_funcs); j++) {
- for (i = 0; i < ARRAY_SIZE (pattern_funcs); i++) {
+ for (j = 0; j < ARRAY_LENGTH (draw_funcs); j++) {
+ for (i = 0; i < ARRAY_LENGTH (pattern_funcs); i++) {
x = i * (WIDTH + PAD) + PAD;
y = j * (HEIGHT + PAD) + PAD;