[Pixman] [PATCH 2/5] test: Cleanup includes

Andrea Canciani ranma42 at gmail.com
Fri Nov 4 05:23:26 PDT 2011


All the tests are linked to libutil, hence it makes sence to always
include utils.h and reuse what it provides (config.h inclusion, access
to private pixman APIs, ARRAY_LENGTH, ...).
---
 test/a1-trap-test.c          |    2 +-
 test/blitters-test.c         |    1 -
 test/composite-traps-test.c  |    1 -
 test/composite.c             |    2 --
 test/fetch-test.c            |    6 +-----
 test/lowlevel-blt-bench.c    |    4 ----
 test/oob-test.c              |    2 +-
 test/region-contains-test.c  |    1 -
 test/region-translate-test.c |    2 +-
 test/scaling-crash-test.c    |    2 +-
 test/scaling-test.c          |    1 -
 test/stress-test.c           |    1 +
 test/trap-crasher.c          |    2 +-
 test/utils.c                 |    1 +
 test/utils.h                 |    1 -
 15 files changed, 8 insertions(+), 21 deletions(-)

diff --git a/test/a1-trap-test.c b/test/a1-trap-test.c
index 6163e7c..93c6caa 100644
--- a/test/a1-trap-test.c
+++ b/test/a1-trap-test.c
@@ -2,7 +2,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include "pixman.h"
+#include "utils.h"
 
 int
 main (int argc, char **argv)
diff --git a/test/blitters-test.c b/test/blitters-test.c
index 4f931c4..6355632 100644
--- a/test/blitters-test.c
+++ b/test/blitters-test.c
@@ -5,7 +5,6 @@
  * Script 'fuzzer-find-diff.pl' can be used to narrow down the problem in
  * the case of test failure.
  */
-#include <assert.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include "utils.h"
diff --git a/test/composite-traps-test.c b/test/composite-traps-test.c
index fa6d8a9..ff03b50 100644
--- a/test/composite-traps-test.c
+++ b/test/composite-traps-test.c
@@ -1,6 +1,5 @@
 /* Based loosely on scaling-test */
 
-#include <assert.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include "utils.h"
diff --git a/test/composite.c b/test/composite.c
index 408c363..fe59eae 100644
--- a/test/composite.c
+++ b/test/composite.c
@@ -22,8 +22,6 @@
  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  * PERFORMANCE OF THIS SOFTWARE.
  */
-#define PIXMAN_USE_INTERNAL_API
-#include <pixman.h>
 #include <stdio.h>
 #include <stdlib.h> /* abort() */
 #include <math.h>
diff --git a/test/fetch-test.c b/test/fetch-test.c
index 9f80eec..fa79ad7 100644
--- a/test/fetch-test.c
+++ b/test/fetch-test.c
@@ -1,11 +1,7 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #include <assert.h>
 #include <stdlib.h>
 #include <stdio.h>
-#include "pixman.h"
+#include "utils.h"
 
 #define SIZE 1024
 
diff --git a/test/lowlevel-blt-bench.c b/test/lowlevel-blt-bench.c
index bdafb35..67cd939 100644
--- a/test/lowlevel-blt-bench.c
+++ b/test/lowlevel-blt-bench.c
@@ -25,10 +25,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-
-#define PIXMAN_USE_INTERNAL_API
-#include <pixman.h>
-
 #include "utils.h"
 
 #define SOLID_FLAG 1
diff --git a/test/oob-test.c b/test/oob-test.c
index 4f9e5a2..9c1a25d 100644
--- a/test/oob-test.c
+++ b/test/oob-test.c
@@ -1,6 +1,6 @@
 #include <stdio.h>
 #include <stdlib.h>
-#include "pixman.h"
+#include "utils.h"
 
 typedef struct
 {
diff --git a/test/region-contains-test.c b/test/region-contains-test.c
index b660fdf..2372686 100644
--- a/test/region-contains-test.c
+++ b/test/region-contains-test.c
@@ -1,4 +1,3 @@
-#include <assert.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include "utils.h"
diff --git a/test/region-translate-test.c b/test/region-translate-test.c
index 0e96a5e..5a03027 100644
--- a/test/region-translate-test.c
+++ b/test/region-translate-test.c
@@ -1,5 +1,5 @@
-#include <pixman.h>
 #include <assert.h>
+#include "utils.h"
 
 /* Pixman had a bug where 32bit regions where clipped to 16bit sizes when
  * pixman_region32_translate() was called. This test exercises that bug.
diff --git a/test/scaling-crash-test.c b/test/scaling-crash-test.c
index 40323d4..50d445d 100644
--- a/test/scaling-crash-test.c
+++ b/test/scaling-crash-test.c
@@ -2,7 +2,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include "pixman.h"
+#include "utils.h"
 
 /*
  * We have a source image filled with solid color, set NORMAL or PAD repeat,
diff --git a/test/scaling-test.c b/test/scaling-test.c
index 82370f7..6f2da14 100644
--- a/test/scaling-test.c
+++ b/test/scaling-test.c
@@ -7,7 +7,6 @@
  * Script 'fuzzer-find-diff.pl' can be used to narrow down the problem in
  * the case of test failure.
  */
-#include <assert.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include "utils.h"
diff --git a/test/stress-test.c b/test/stress-test.c
index 571420a..08bf1d4 100644
--- a/test/stress-test.c
+++ b/test/stress-test.c
@@ -1,4 +1,5 @@
 #include <stdio.h>
+#include <stdlib.h>
 #include "utils.h"
 #include <sys/types.h>
 
diff --git a/test/trap-crasher.c b/test/trap-crasher.c
index 7485e62..db7e01a 100644
--- a/test/trap-crasher.c
+++ b/test/trap-crasher.c
@@ -1,5 +1,5 @@
 #include <stdlib.h>
-#include <pixman.h>
+#include "utils.h"
 
 int
 main()
diff --git a/test/utils.c b/test/utils.c
index adabd75..204066f 100644
--- a/test/utils.c
+++ b/test/utils.c
@@ -2,6 +2,7 @@
 
 #include "utils.h"
 #include <signal.h>
+#include <stdlib.h>
 
 #ifdef HAVE_GETTIMEOFDAY
 #include <sys/time.h>
diff --git a/test/utils.h b/test/utils.h
index b23925c..3bff78e 100644
--- a/test/utils.h
+++ b/test/utils.h
@@ -2,7 +2,6 @@
 #include <config.h>
 #endif
 
-#include <stdlib.h>
 #include <assert.h>
 #include "pixman-private.h" /* For 'inline' definition */
 
-- 
1.7.5.4



More information about the Pixman mailing list