summaryrefslogtreecommitdiff
path: root/test/cairo-test-runner.c
diff options
context:
space:
mode:
authorAndrea Canciani <ranma42@gmail.com>2011-10-28 15:04:59 +0200
committerAndrea Canciani <ranma42@gmail.com>2011-11-12 20:49:08 +0100
commit603ea229b54c858d12ffc80a478f1fb0f4023a72 (patch)
treeec371db7748fb9474da4b2c85d0d2b518215346f /test/cairo-test-runner.c
parentabced5b88281a2ada819ccfe670616024765b7f7 (diff)
downloadcairo-603ea229b54c858d12ffc80a478f1fb0f4023a72.tar.gz
test: Use cairo_test_list_t for the main test list
Instead of embedding the pointer in the test structure, consistently use the cairo_test_list_t structure for test lists. This cleans up the code as the reverse-list operation can be reused. Moreover this makes the code clearer, because each test list is now independent and has no way to know about other test lists.
Diffstat (limited to 'test/cairo-test-runner.c')
-rw-r--r--test/cairo-test-runner.c24
1 files changed, 6 insertions, 18 deletions
diff --git a/test/cairo-test-runner.c b/test/cairo-test-runner.c
index 6a1fc983d..b0e598dbc 100644
--- a/test/cairo-test-runner.c
+++ b/test/cairo-test-runner.c
@@ -107,7 +107,7 @@ typedef enum {
GT
} cairo_test_compare_op_t;
-static cairo_test_t *tests;
+static cairo_test_list_t *tests;
static void CAIRO_BOILERPLATE_PRINTF_FORMAT(2,3)
_log (cairo_test_context_t *ctx,
@@ -125,18 +125,6 @@ _log (cairo_test_context_t *ctx,
va_end (ap);
}
-static void
-_tests_reverse (void)
-{
- cairo_test_t *list, *next;
-
- for (list = tests, tests = NULL; list != NULL; list = next) {
- next = list->next;
- list->next = tests;
- tests = list;
- }
-}
-
static cairo_test_list_t *
_list_prepend (cairo_test_list_t *head, const cairo_test_t *test)
{
@@ -709,7 +697,7 @@ int
main (int argc, char **argv)
{
cairo_test_runner_t runner;
- cairo_test_t *test;
+ cairo_test_list_t *test_list;
cairo_test_status_t *target_status;
unsigned int n, m;
char targets[4096];
@@ -723,7 +711,7 @@ main (int argc, char **argv)
#endif
_cairo_test_runner_register_tests ();
- _tests_reverse ();
+ tests = _list_reverse (tests);
memset (&runner, 0, sizeof (runner));
runner.num_device_offsets = 1;
@@ -768,7 +756,8 @@ main (int argc, char **argv)
runner.base.num_targets);
}
- for (test = tests; test != NULL; test = test->next) {
+ for (test_list = tests; test_list != NULL; test_list = test_list->next) {
+ const cairo_test_t *test = test_list->test;
cairo_test_context_t ctx;
cairo_test_status_t status;
cairo_bool_t failed = FALSE, xfailed = FALSE, error = FALSE, crashed = FALSE, skipped = TRUE;
@@ -1097,6 +1086,5 @@ main (int argc, char **argv)
void
cairo_test_register (cairo_test_t *test)
{
- test->next = tests;
- tests = test;
+ tests = _list_prepend (tests, test);
}