summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2009-01-03 22:51:28 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2009-01-03 22:56:17 +0000
commit388ae177e4100698289819429fa1f8e6958d1c60 (patch)
treee97f0c4bb3ee5d9ac9e5e095a26582f8e888f748
parent5f816ccd25d1cd303fc1e9e44e80c1207b2a424a (diff)
[boilerplate] Remove CAIRO_BOILERPLATE_LOG()
The variadic macro is only used within boilerplate/ so replace it with a simple, and portable, call to fprintf.
-rw-r--r--boilerplate/cairo-boilerplate-beos.cpp19
-rw-r--r--boilerplate/cairo-boilerplate-glitz-agl.c10
-rw-r--r--boilerplate/cairo-boilerplate-glitz-glx.c6
-rw-r--r--boilerplate/cairo-boilerplate-glitz-wgl.c10
-rw-r--r--boilerplate/cairo-boilerplate-system.c16
-rw-r--r--boilerplate/cairo-boilerplate-xcb.c4
-rw-r--r--boilerplate/cairo-boilerplate.h4
-rw-r--r--test/cairo-test.h1
8 files changed, 26 insertions, 44 deletions
diff --git a/boilerplate/cairo-boilerplate-beos.cpp b/boilerplate/cairo-boilerplate-beos.cpp
index 2a84d1b3..497d9277 100644
--- a/boilerplate/cairo-boilerplate-beos.cpp
+++ b/boilerplate/cairo-boilerplate-beos.cpp
@@ -38,10 +38,6 @@
*
* ***** END LICENSE BLOCK ***** */
-// BeOS's C++ compiler does not support varargs in macros
-// So, define CAIRO_BOILERPLATE_LOG here
-#define CAIRO_BOILERPLATE_LOG cairo_beos_boilerplate_log
-
extern "C" {
#include "cairo-boilerplate.h"
}
@@ -57,15 +53,6 @@ extern "C" {
#include <View.h>
#include <Bitmap.h>
-static int cairo_beos_boilerplate_log(const char* format, ...) {
- va_list args;
- int rv;
- va_start(args, format);
- rv = vfprintf(stderr, format, args);
- va_end(args);
- return rv;
-}
-
class CairoTestWindow : public BWindow
{
public:
@@ -142,18 +129,18 @@ AppRunner::AppRunner()
sem_id initsem = create_sem(0, "Cairo BApplication init");
if (initsem < B_OK) {
- CAIRO_BOILERPLATE_LOG("Error creating BeOS initialization semaphore\n");
+ fprintf (stderr, "Error creating BeOS initialization semaphore\n");
return;
}
thread_id tid = spawn_thread(nsBeOSApp::Main, "Cairo/BeOS test", B_NORMAL_PRIORITY, (void *)initsem);
if (tid < B_OK || B_OK != resume_thread(tid)) {
- CAIRO_BOILERPLATE_LOG("Error spawning thread\n");
+ fprintf (stderr, "Error spawning thread\n");
return;
}
if (B_OK != acquire_sem(initsem)) {
- CAIRO_BOILERPLATE_LOG("Error acquiring semaphore\n");
+ fprintf (stderr, "Error acquiring semaphore\n");
return;
}
diff --git a/boilerplate/cairo-boilerplate-glitz-agl.c b/boilerplate/cairo-boilerplate-glitz-agl.c
index 06b90308..dd10a00e 100644
--- a/boilerplate/cairo-boilerplate-glitz-agl.c
+++ b/boilerplate/cairo-boilerplate-glitz-agl.c
@@ -66,25 +66,25 @@ _cairo_boilerplate_glitz_agl_create_surface_internal (glitz_format_name_t form
dformat = glitz_agl_find_pbuffer_format (mask, &templ, 0);
if (!dformat) {
- CAIRO_BOILERPLATE_LOG ("Glitz failed to find pbuffer format for template.");
+ fprintf (stderr, "Glitz failed to find pbuffer format for template.");
goto FAIL;
}
gdraw = glitz_agl_create_pbuffer_drawable (dformat, width, height);
if (!gdraw) {
- CAIRO_BOILERPLATE_LOG ("Glitz failed to create pbuffer drawable.");
+ fprintf (stderr, "Glitz failed to create pbuffer drawable.");
goto FAIL;
}
format = glitz_find_standard_format (gdraw, formatname);
if (!format) {
- CAIRO_BOILERPLATE_LOG ("Glitz failed to find standard format for drawable.");
+ fprintf (stderr, "Glitz failed to find standard format for drawable.");
goto DESTROY_DRAWABLE;
}
sr = glitz_surface_create (gdraw, format, width, height, 0, NULL);
if (!sr) {
- CAIRO_BOILERPLATE_LOG ("Glitz failed to create a surface.");
+ fprintf (stderr, "Glitz failed to create a surface.");
goto DESTROY_DRAWABLE;
}
@@ -127,7 +127,7 @@ _cairo_boilerplate_glitz_agl_create_surface (const char *name,
break;
case CAIRO_CONTENT_ALPHA:
default:
- CAIRO_BOILERPLATE_LOG ("Invalid content for glitz-agl test: %d\n", content);
+ fprintf (stderr, "Invalid content for glitz-agl test: %d\n", content);
goto FAIL;
}
diff --git a/boilerplate/cairo-boilerplate-glitz-glx.c b/boilerplate/cairo-boilerplate-glitz-glx.c
index 5dcf8b69..4c26b877 100644
--- a/boilerplate/cairo-boilerplate-glitz-glx.c
+++ b/boilerplate/cairo-boilerplate-glitz-glx.c
@@ -176,7 +176,7 @@ _cairo_boilerplate_glitz_glx_create_surface (const char *name,
gxtc->dpy = XOpenDisplay (getenv("CAIRO_TEST_GLITZ_DISPLAY"));
if (!gxtc->dpy) {
- CAIRO_BOILERPLATE_LOG ("Failed to open display: %s\n", XDisplayName(0));
+ fprintf (stderr, "Failed to open display: %s\n", XDisplayName(0));
goto FAIL;
}
@@ -193,11 +193,11 @@ _cairo_boilerplate_glitz_glx_create_surface (const char *name,
break;
case CAIRO_CONTENT_ALPHA:
default:
- CAIRO_BOILERPLATE_LOG ("Invalid content for glitz-glx test: %d\n", content);
+ fprintf (stderr, "Invalid content for glitz-glx test: %d\n", content);
goto FAIL_CLOSE_DISPLAY;
}
if (!glitz_surface) {
- CAIRO_BOILERPLATE_LOG ("Failed to create glitz-glx surface\n");
+ fprintf (stderr, "Failed to create glitz-glx surface\n");
goto FAIL_CLOSE_DISPLAY;
}
diff --git a/boilerplate/cairo-boilerplate-glitz-wgl.c b/boilerplate/cairo-boilerplate-glitz-wgl.c
index b11a8189..dfd764f6 100644
--- a/boilerplate/cairo-boilerplate-glitz-wgl.c
+++ b/boilerplate/cairo-boilerplate-glitz-wgl.c
@@ -66,25 +66,25 @@ _cairo_boilerplate_glitz_wgl_create_surface_internal (glitz_format_name_t form
dformat = glitz_wgl_find_pbuffer_format (mask, &templ, 0);
if (!dformat) {
- CAIRO_BOILERPLATE_LOG ("Glitz failed to find pbuffer format for template.");
+ fprintf (stderr, "Glitz failed to find pbuffer format for template.");
goto FAIL;
}
gdraw = glitz_wgl_create_pbuffer_drawable (dformat, width, height);
if (!gdraw) {
- CAIRO_BOILERPLATE_LOG ("Glitz failed to create pbuffer drawable.");
+ fprintf (stderr, "Glitz failed to create pbuffer drawable.");
goto FAIL;
}
format = glitz_find_standard_format (gdraw, formatname);
if (!format) {
- CAIRO_BOILERPLATE_LOG ("Glitz failed to find standard format for drawable.");
+ fprintf (stderr, "Glitz failed to find standard format for drawable.");
goto DESTROY_DRAWABLE;
}
sr = glitz_surface_create (gdraw, format, width, height, 0, NULL);
if (!sr) {
- CAIRO_BOILERPLATE_LOG ("Glitz failed to create a surface.");
+ fprintf (stderr, "Glitz failed to create a surface.");
goto DESTROY_DRAWABLE;
}
@@ -124,7 +124,7 @@ _cairo_boilerplate_glitz_wgl_create_surface (const char *name,
glitz_surface = _cairo_boilerplate_glitz_wgl_create_surface_internal (GLITZ_STANDARD_ARGB32, width, height, NULL);
break;
default:
- CAIRO_BOILERPLATE_LOG ("Invalid content for glitz-wgl test: %d\n", content);
+ fprintf (stderr, "Invalid content for glitz-wgl test: %d\n", content);
goto FAIL;
}
diff --git a/boilerplate/cairo-boilerplate-system.c b/boilerplate/cairo-boilerplate-system.c
index af076815..3855b73e 100644
--- a/boilerplate/cairo-boilerplate-system.c
+++ b/boilerplate/cairo-boilerplate-system.c
@@ -46,7 +46,7 @@ xmalloc (size_t size)
buf = malloc (size);
if (buf == NULL) {
- CAIRO_BOILERPLATE_LOG ("Error: Out of memory. Exiting.\n");
+ fprintf (stderr, "Error: Out of memory. Exiting.\n");
exit (1);
}
@@ -63,7 +63,7 @@ xcalloc (size_t nmemb, size_t size)
buf = calloc (nmemb, size);
if (buf == NULL) {
- CAIRO_BOILERPLATE_LOG ("Error: Out of memory. Exiting\n");
+ fprintf (stderr, "Error: Out of memory. Exiting\n");
exit (1);
}
@@ -75,7 +75,7 @@ xrealloc (void *buf, size_t size)
{
buf = realloc (buf, size);
if (buf == NULL && size != 0) {
- CAIRO_BOILERPLATE_LOG ("Error: Out of memory. Exiting\n");
+ fprintf (stderr, "Error: Out of memory. Exiting\n");
exit (1);
}
@@ -94,7 +94,7 @@ xasprintf (char **strp, const char *fmt, ...)
va_end (va);
if (ret < 0) {
- CAIRO_BOILERPLATE_LOG ("Error: Out of memory. Exiting.\n");
+ fprintf (stderr, "Error: Out of memory. Exiting.\n");
exit (1);
}
#else /* !HAVE_VASNPRINTF */
@@ -108,14 +108,14 @@ xasprintf (char **strp, const char *fmt, ...)
va_end (va);
if (ret < 0) {
- CAIRO_BOILERPLATE_LOG ("Failure in vsnprintf\n");
+ fprintf (stderr, "Failure in vsnprintf\n");
exit (1);
}
len = (ret + sizeof (int)) & -sizeof (int);
*strp = malloc (len);
if (*strp == NULL) {
- CAIRO_BOILERPLATE_LOG ("Out of memory\n");
+ fprintf (stderr, "Out of memory\n");
exit (1);
}
@@ -128,7 +128,7 @@ xasprintf (char **strp, const char *fmt, ...)
if (ret >= len) {
free (*strp);
- CAIRO_BOILERPLATE_LOG ("Overflowed dynamic buffer\n");
+ fprintf (stderr, "Overflowed dynamic buffer\n");
exit (1);
}
}
@@ -140,7 +140,7 @@ void
xunlink (const char *pathname)
{
if (unlink (pathname) < 0 && errno != ENOENT) {
- CAIRO_BOILERPLATE_LOG ("Error: Cannot remove %s: %s\n",
+ fprintf (stderr, "Error: Cannot remove %s: %s\n",
pathname, strerror (errno));
exit (1);
}
diff --git a/boilerplate/cairo-boilerplate-xcb.c b/boilerplate/cairo-boilerplate-xcb.c
index dca7acf9..306f874a 100644
--- a/boilerplate/cairo-boilerplate-xcb.c
+++ b/boilerplate/cairo-boilerplate-xcb.c
@@ -73,7 +73,7 @@ _cairo_boilerplate_xcb_create_surface (const char *name,
xtc->c = c = xcb_connect(NULL,NULL);
if (xcb_connection_has_error(c)) {
- CAIRO_BOILERPLATE_LOG ("Failed to connect to X server through XCB\n");
+ fprintf (stderr, "Failed to connect to X server through XCB\n");
return NULL;
}
@@ -92,7 +92,7 @@ _cairo_boilerplate_xcb_create_surface (const char *name,
break;
case CAIRO_CONTENT_ALPHA: /* would be XCB_PICT_STANDARD_A_8 */
default:
- CAIRO_BOILERPLATE_LOG ("Invalid content for XCB test: %d\n", content);
+ fprintf (stderr, "Invalid content for XCB test: %d\n", content);
return NULL;
}
diff --git a/boilerplate/cairo-boilerplate.h b/boilerplate/cairo-boilerplate.h
index 9f4b00cb..d3b86d17 100644
--- a/boilerplate/cairo-boilerplate.h
+++ b/boilerplate/cairo-boilerplate.h
@@ -70,10 +70,6 @@
# define UINT16_MAX (65535)
#endif
-#ifndef CAIRO_BOILERPLATE_LOG
-#define CAIRO_BOILERPLATE_LOG(...) fprintf(stderr, __VA_ARGS__)
-#endif
-
#ifndef CAIRO_BOILERPLATE_DEBUG
#define CAIRO_BOILERPLATE_DEBUG(x)
#endif
diff --git a/test/cairo-test.h b/test/cairo-test.h
index 5bb23ae9..a9dbf19b 100644
--- a/test/cairo-test.h
+++ b/test/cairo-test.h
@@ -26,7 +26,6 @@
#ifndef _CAIRO_TEST_H_
#define _CAIRO_TEST_H_
-#define CAIRO_BOILERPLATE_LOG(...) cairo_test_log (__VA_ARGS__)
#include "cairo-boilerplate.h"
#include <stdarg.h>