mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 05:18:01 +02:00
[boilerplate] Remove CAIRO_BOILERPLATE_LOG()
The variadic macro is only used within boilerplate/ so replace it with a simple, and portable, call to fprintf.
This commit is contained in:
parent
5f816ccd25
commit
388ae177e4
8 changed files with 26 additions and 44 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue