diff options
author | Andrea Canciani <ranma42@gmail.com> | 2011-03-16 16:48:18 +0100 |
---|---|---|
committer | Andrea Canciani <ranma42@gmail.com> | 2011-03-17 17:45:57 +0100 |
commit | 75fea162d985bea622afa59771fb2d07f5241d1b (patch) | |
tree | 5876692cd2ba574481210fae292eaf7f06005028 /test/operator-source.c | |
parent | 4ef32a36ba1e457e8dd6244a6483866d33477aac (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-source.c')
-rw-r--r-- | test/operator-source.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/test/operator-source.c b/test/operator-source.c index c92b4ad72..d734167c6 100644 --- a/test/operator-source.c +++ b/test/operator-source.c @@ -175,9 +175,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) @@ -190,8 +189,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; |