test: Use ARRAY_LENGTH macro

This commit is contained in:
Bryce Harrington 2014-11-14 18:10:16 -08:00
parent ae608035c7
commit 7edc5a8844
3 changed files with 3 additions and 4 deletions

View file

@ -56,7 +56,6 @@ static const struct spline {
{ 1, 0, 0, 1 },
}
};
#define NUM_SPLINES (sizeof(splines)/sizeof(splines[0]))
static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
@ -68,7 +67,7 @@ draw (cairo_t *cr, int width, int height)
cairo_set_line_cap(cr, CAIRO_LINE_CAP_SQUARE);
for (n = 0; n < NUM_SPLINES; n++) {
for (n = 0; n < ARRAY_LENGTH(splines); n++) {
cairo_set_line_width (cr, splines[n].line_width);
cairo_set_source_rgba (cr,
splines[n].rgba[0],

View file

@ -100,7 +100,7 @@ draw (cairo_t *cr, int width, int height)
cairo_set_line_width (cr, LINE_WIDTH);
for (t = 0; t < sizeof(theta)/sizeof (theta[0]); t++) {
for (t = 0; t < ARRAY_LENGTH(theta); t++) {
cairo_save (cr);
cairo_translate (cr, 0, t * (SIZE + PAD) + PAD);
draw_caps_joins (cr, theta[t]);

View file

@ -37,7 +37,7 @@ draw (cairo_t *cr, int width, int height)
cairo_translate (cr, width/2, height/2);
cairo_scale (cr, .85, .85);
for (i = 0; i < sizeof (tiger_commands)/sizeof(tiger_commands[0]);i++) {
for (i = 0; i < ARRAY_LENGTH(tiger_commands); i++) {
const struct command *cmd = &tiger_commands[i];
switch (cmd->type) {
case 'm':