Refactor ARRAY_LENGTH macro definitions in test code

This commit is contained in:
Bryce Harrington 2014-11-20 12:19:47 -08:00
parent 7edc5a8844
commit 2c5af590dd
7 changed files with 6 additions and 16 deletions

View file

@ -54,8 +54,6 @@ typedef struct _pdf_target_closure
cairo_surface_t *target; cairo_surface_t *target;
} pdf_target_closure_t; } pdf_target_closure_t;
#define ARRAY_LENGTH(__array) ((int) (sizeof (__array) / sizeof (__array[0])))
static cairo_surface_t * static cairo_surface_t *
_cairo_boilerplate_pdf_create_surface (const char *name, _cairo_boilerplate_pdf_create_surface (const char *name,
cairo_content_t content, cairo_content_t content,

View file

@ -41,7 +41,7 @@ _cairo_boilerplate_register_backend (const cairo_boilerplate_target_t *targets,
void _register_##name__ (void); \ void _register_##name__ (void); \
void _register_##name__ (void) { \ void _register_##name__ (void) { \
_cairo_boilerplate_register_backend (targets__, \ _cairo_boilerplate_register_backend (targets__, \
sizeof (targets__) / sizeof (targets__[0])); \ ARRAY_LENGTH(targets__)); \
} }
#define CAIRO_NO_BOILERPLATE(name__) \ #define CAIRO_NO_BOILERPLATE(name__) \

View file

@ -94,6 +94,10 @@
#define M_PI 3.14159265358979323846 #define M_PI 3.14159265358979323846
#endif #endif
#ifndef ARRAY_LENGTH
#define ARRAY_LENGTH(__array) ((int) (sizeof (__array) / sizeof (__array[0])))
#endif
CAIRO_BEGIN_DECLS CAIRO_BEGIN_DECLS
/* A fake format we use for the flattened ARGB output of the PS and /* A fake format we use for the flattened ARGB output of the PS and

View file

@ -203,10 +203,6 @@ test_report_cmp_name (const void *a,
#define MAX(a, b) ((a) > (b) ? (a) : (b)) #define MAX(a, b) ((a) > (b) ? (a) : (b))
#endif #endif
#ifndef ARRAY_LENGTH
#define ARRAY_LENGTH(__array) ((int) (sizeof (__array) / sizeof (__array[0])))
#endif
CAIRO_PERF_DECL (fill); CAIRO_PERF_DECL (fill);
CAIRO_PERF_DECL (paint); CAIRO_PERF_DECL (paint);
CAIRO_PERF_DECL (paint_with_alpha); CAIRO_PERF_DECL (paint_with_alpha);

View file

@ -100,7 +100,7 @@
#endif #endif
#endif #endif
#define ARRAY_LENGTH(A) (sizeof (A) / sizeof (A[0])) #define ARRAY_LENGTH(__array) ((int) (sizeof (__array) / sizeof (__array[0])))
static int static int
_cairo_writen (int fd, char *buf, int len) _cairo_writen (int fd, char *buf, int len)

View file

@ -83,10 +83,6 @@
#define TRUE !FALSE #define TRUE !FALSE
#endif #endif
#ifndef ARRAY_LENGTH
#define ARRAY_LENGTH(__array) ((int) (sizeof (__array) / sizeof (__array[0])))
#endif
#if ! HAVE_ALARM || ! defined(SIGALRM) #if ! HAVE_ALARM || ! defined(SIGALRM)
#define alarm(X); #define alarm(X);
#endif #endif

View file

@ -107,10 +107,6 @@ cairo_test_NaN (void)
#define MAX(a, b) ((a) > (b) ? (a) : (b)) #define MAX(a, b) ((a) > (b) ? (a) : (b))
#endif #endif
#ifndef ARRAY_LENGTH
#define ARRAY_LENGTH(__array) ((int) (sizeof (__array) / sizeof (__array[0])))
#endif
#define CAIRO_TEST_OUTPUT_DIR "output" #define CAIRO_TEST_OUTPUT_DIR "output"
#define CAIRO_TEST_LOG_SUFFIX ".log" #define CAIRO_TEST_LOG_SUFFIX ".log"