summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2005-05-06 21:33:22 +0000
committerCarl Worth <cworth@cworth.org>2005-05-06 21:33:22 +0000
commit10c88d424485c7f001e9e03c121aa7c3b55336cc (patch)
treecea9516a466c2f28bf7f68280cd90003af73448c
parent9939e01b693a885496cfa82430b91c11a121269e (diff)
Change definitions of everything in cairo-features.h to prefer #if over #ifdef.
Track #ifdef -> #if changes. Add support to automatically change all #ifdef CAIRO_HAS to #if CAIRO_HAS.
-rw-r--r--ChangeLog26
-rw-r--r--configure.in135
-rw-r--r--src/cairo-atsui.h2
-rw-r--r--src/cairo-cache.c6
-rw-r--r--src/cairo-features.h.in24
-rw-r--r--src/cairo-ft-private.h2
-rw-r--r--src/cairo-ft.h2
-rw-r--r--src/cairo-glitz.h2
-rw-r--r--src/cairo-hash.c6
-rw-r--r--src/cairo-pdf.h2
-rw-r--r--src/cairo-ps.h2
-rw-r--r--src/cairo-quartz.h2
-rw-r--r--src/cairo-win32.h2
-rw-r--r--src/cairo-xcb.h2
-rw-r--r--src/cairo-xlib.h2
-rw-r--r--src/cairo.c7
-rw-r--r--src/cairo.h4
-rw-r--r--src/cairoint.h12
-rw-r--r--test/cairo-test.c16
-rwxr-xr-xutil/cairo-api-update1
20 files changed, 127 insertions, 130 deletions
diff --git a/ChangeLog b/ChangeLog
index 20f1c91a..a3c08737 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,31 @@
2005-05-07 Carl Worth <cworth@cworth.org>
+ * configure.in:
+
+ * src/cairo-features.h.in: Change definitions of everything in
+ cairo-features.h to prefer #if over #ifdef.
+
+ * src/cairo-atsui.h:
+ * src/cairo-cache.c:
+ * src/cairo-ft-private.h:
+ * src/cairo-ft.h:
+ * src/cairo-glitz.h:
+ * src/cairo-pdf.h:
+ * src/cairo-ps.h:
+ * src/cairo-quartz.h:
+ * src/cairo-win32.h:
+ * src/cairo-xcb.h:
+ * src/cairo-xlib.h:
+ * src/cairo.c:
+ * src/cairo.h:
+ * src/cairoint.h:
+ * test/cairo-test.c: Track #ifdef -> #if changes.
+
+ * util/cairo-api-update: Add support to automatically change all
+ #ifdef CAIRO_HAS to #if CAIRO_HAS.
+
+2005-05-07 Carl Worth <cworth@cworth.org>
+
* src/cairo-gstate.c:
* src/cairo-pattern.c:
* src/cairo.c:
diff --git a/configure.in b/configure.in
index 154f0813..9693f084 100644
--- a/configure.in
+++ b/configure.in
@@ -63,15 +63,14 @@ if test "x$use_xlib" = "xyes"; then
use_xlib="no (requires Xrender http://freedesktop.org/software/xlibs)"])])
fi
-if test "x$use_xlib" != "xyes"; then
- XLIB_SURFACE_FEATURE=CAIRO_HAS_NO_XLIB_SURFACE
- AM_CONDITIONAL(CAIRO_HAS_XLIB_SURFACE, false)
+AM_CONDITIONAL(CAIRO_HAS_XLIB_SURFACE, test "x$use_xlib" = "xyes")
+if test "x$use_xlib" = "xyes"; then
+ XLIB_SURFACE_FEATURE=1
else
- XLIB_SURFACE_FEATURE=CAIRO_HAS_XLIB_SURFACE
- AM_CONDITIONAL(CAIRO_HAS_XLIB_SURFACE, true)
+ XLIB_SURFACE_FEATURE=0
fi
-
AC_SUBST(XLIB_SURFACE_FEATURE)
+
AC_SUBST(XRENDER_REQUIRES)
CAIRO_CFLAGS="$CAIRO_CFLAGS $XRENDER_CFLAGS"
@@ -86,15 +85,13 @@ if test "x$use_quartz" = "xyes"; then
AC_CHECK_HEADER(Carbon/Carbon.h, [use_quartz=yes], [use_quartz=no])
fi
-if test "x$use_quartz" != "xyes"; then
- QUARTZ_SURFACE_FEATURE=CAIRO_HAS_NO_QUARTZ_SURFACE
- AM_CONDITIONAL(CAIRO_HAS_QUARTZ_SURFACE, false)
-else
- QUARTZ_SURFACE_FEATURE=CAIRO_HAS_QUARTZ_SURFACE
+AM_CONDITIONAL(CAIRO_HAS_QUARTZ_SURFACE, test "x$use_quartz" = "xyes")
+if test "x$use_quartz" = "xyes"; then
+ QUARTZ_SURFACE_FEATURE=1
QUARTZ_LIBS="-Xlinker -framework -Xlinker Carbon"
- AM_CONDITIONAL(CAIRO_HAS_QUARTZ_SURFACE, true)
+else
+ QUARTZ_SURFACE_FEATURE=0
fi
-
AC_SUBST(QUARTZ_SURFACE_FEATURE)
CAIRO_LIBS="$CAIRO_LIBS $QUARTZ_LIBS"
@@ -109,18 +106,17 @@ if test "x$use_xcb" = "xyes"; then
use_xcb="no (requires XCB http://freedesktop.org/software/xcb)"])
fi
-if test "x$use_xcb" != "xyes"; then
- XCB_SURFACE_FEATURE=CAIRO_HAS_NO_XCB_SURFACE
- AM_CONDITIONAL(CAIRO_HAS_XCB_SURFACE, false)
+AM_CONDITIONAL(CAIRO_HAS_XCB_SURFACE, test "x$use_xcb" = "xyes")
+if test "x$use_xcb" = "xyes"; then
+ XCB_SURFACE_FEATURE=1
else
- XCB_SURFACE_FEATURE=CAIRO_HAS_XCB_SURFACE
- AM_CONDITIONAL(CAIRO_HAS_XCB_SURFACE, true)
+ XCB_SURFACE_FEATURE=0
fi
+AC_SUBST(XCB_SURFACE_FEATURE)
CAIRO_CFLAGS="$CAIRO_CFLAGS $XCB_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS $XCB_LIBS"
-AC_SUBST(XCB_SURFACE_FEATURE)
dnl ===========================================================================
@@ -147,23 +143,20 @@ if test "x$use_win32" = "xyes"; then
CAIRO_LIBS="$CAIRO_LIBS -lgdi32 -lmsimg32"
fi
-if test "x$use_win32" != "xyes"; then
- WIN32_SURFACE_FEATURE=CAIRO_HAS_NO_WIN32_SURFACE
- AM_CONDITIONAL(CAIRO_HAS_WIN32_SURFACE, false)
+AM_CONDITIONAL(CAIRO_HAS_WIN32_SURFACE, test "x$use_win32" = "xyes")
+if test "x$use_win32" = "xyes"; then
+ WIN32_SURFACE_FEATURE=1
else
- WIN32_SURFACE_FEATURE=CAIRO_HAS_WIN32_SURFACE
- AM_CONDITIONAL(CAIRO_HAS_WIN32_SURFACE, true)
+ WIN32_SURFACE_FEATURE=0
fi
+AC_SUBST(WIN32_SURFACE_FEATURE)
-if test "x$use_win32" != "xyes"; then
- WIN32_FONT_FEATURE=CAIRO_HAS_NO_WIN32_FONT
- AM_CONDITIONAL(CAIRO_HAS_WIN32_FONT, false)
+AM_CONDITIONAL(CAIRO_HAS_WIN32_FONT, test "x$use_win32" = "xyes")
+if test "x$use_win32" = "xyes"; then
+ WIN32_FONT_FEATURE=1
else
- WIN32_FONT_FEATURE=CAIRO_HAS_WIN32_FONT
- AM_CONDITIONAL(CAIRO_HAS_WIN32_FONT, true)
+ WIN32_FONT_FEATURE=0
fi
-
-AC_SUBST(WIN32_SURFACE_FEATURE)
AC_SUBST(WIN32_FONT_FEATURE)
dnl ===========================================================================
@@ -178,18 +171,17 @@ AC_CHECK_LIB(z, compress,
[use_ps="no (requires zlib http://www.gzip.org/zlib/)"])],
[use_ps="no (requires zlib http://www.gzip.org/zlib/)"])
-if test "x$use_ps" != "xyes"; then
- PS_SURFACE_FEATURE=CAIRO_HAS_NO_PS_SURFACE
- AM_CONDITIONAL(CAIRO_HAS_PS_SURFACE, false)
-else
- PS_SURFACE_FEATURE=CAIRO_HAS_PS_SURFACE
+AM_CONDITIONAL(CAIRO_HAS_PS_SURFACE, test "x$use_ps" = "xyes")
+if test "x$use_ps" = "xyes"; then
+ PS_SURFACE_FEATURE=1
PS_LIBS=-lz
- AM_CONDITIONAL(CAIRO_HAS_PS_SURFACE, true)
+else
+ PS_SURFACE_FEATURE=0
fi
+AC_SUBST(PS_SURFACE_FEATURE)
CAIRO_LIBS="$CAIRO_LIBS $PS_LIBS"
-AC_SUBST(PS_SURFACE_FEATURE)
AC_SUBST(PS_LIBS)
dnl ===========================================================================
@@ -217,18 +209,17 @@ if test "x$use_png" = "xyes"; then
fi
fi
-if test "x$use_png" != "xyes"; then
- PNG_FUNCTIONS_FEATURE=CAIRO_HAS_NO_PNG_FUNCTIONS
- AM_CONDITIONAL(CAIRO_HAS_PNG_FUNCTIONS, false)
+AM_CONDITIONAL(CAIRO_HAS_PNG_FUNCTIONS, test "x$use_png" = "xyes")
+if test "x$use_png" = "xyes"; then
+ PNG_FUNCTIONS_FEATURE=1
else
- PNG_FUNCTIONS_FEATURE=CAIRO_HAS_PNG_FUNCTIONS
- AM_CONDITIONAL(CAIRO_HAS_PNG_FUNCTIONS, true)
+ PNG_FUNCTIONS_FEATURE=0
fi
+AC_SUBST(PNG_FUNCTIONS_FEATURE)
CAIRO_CFLAGS="$CAIRO_CFLAGS $PNG_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS $PNG_LIBS"
-AC_SUBST(PNG_FUNCTIONS_FEATURE)
AC_SUBST(PNG_REQUIRES)
dnl ===========================================================================
@@ -243,36 +234,21 @@ if test "x$use_glitz" = "xyes"; then
use_glitz=yes], [use_glitz="no (requires glitz http://freedesktop.org/software/glitz)"])
fi
-if test "x$use_glitz" != "xyes"; then
- GLITZ_SURFACE_FEATURE=CAIRO_HAS_NO_GLITZ_SURFACE
- AM_CONDITIONAL(CAIRO_HAS_GLITZ_SURFACE, false)
+AM_CONDITIONAL(CAIRO_HAS_GLITZ_SURFACE, test "x$use_glitz" = "xyes")
+if test "x$use_glitz" = "xyes"; then
+ GLITZ_SURFACE_FEATURE=1
else
- GLITZ_SURFACE_FEATURE=CAIRO_HAS_GLITZ_SURFACE
- AM_CONDITIONAL(CAIRO_HAS_GLITZ_SURFACE, true)
+ GLITZ_SURFACE_FEATURE=0
fi
+AC_SUBST(GLITZ_SURFACE_FEATURE)
CAIRO_CFLAGS="$CAIRO_CFLAGS $GLITZ_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS $GLITZ_LIBS"
-AC_SUBST(GLITZ_SURFACE_FEATURE)
AC_SUBST(GLITZ_REQUIRES)
dnl ===========================================================================
-AC_ARG_ENABLE(sanity-checking,
- [ --disable-sanity Disable cairo's sanity checking routines],
- [check_sanity=$enableval], [check_sanity=yes])
-
-if test "x$check_sanity" != "xyes"; then
- SANITY_CHECKING_FEATURE=CAIRO_NO_SANITY_CHECKING
-else
- SANITY_CHECKING_FEATURE=CAIRO_DO_SANITY_CHECKING
-fi
-
-AC_SUBST(SANITY_CHECKING_FEATURE)
-
-dnl ===========================================================================
-
PKG_CHECK_MODULES(PIXMAN, libpixman >= 0.1.4)
CAIRO_CFLAGS="$CAIRO_CFLAGS $PIXMAN_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS $PIXMAN_LIBS"
@@ -339,12 +315,11 @@ fi
CAIRO_CFLAGS="$CAIRO_CFLAGS $FREETYPE_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS $FREETYPE_LIBS"
-if test "x$use_freetype" != "xyes"; then
- FT_FONT_FEATURE=CAIRO_HAS_NO_FT_FONT
- AM_CONDITIONAL(CAIRO_HAS_FT_FONT, false)
+AM_CONDITIONAL(CAIRO_HAS_FT_FONT, test "x$use_freetype" = "xyes")
+if test "x$use_freetype" = "xyes"; then
+ FT_FONT_FEATURE=1
else
- FT_FONT_FEATURE=CAIRO_HAS_FT_FONT
- AM_CONDITIONAL(CAIRO_HAS_FT_FONT, true)
+ FT_FONT_FEATURE=0
fi
AC_SUBST(FT_FONT_FEATURE)
@@ -359,18 +334,17 @@ if test x"$use_freetype" != "xyes" ; then
use_pdf=no
fi
-if test "x$use_pdf" != "xyes"; then
- PDF_SURFACE_FEATURE=CAIRO_HAS_NO_PDF_SURFACE
- AM_CONDITIONAL(CAIRO_HAS_PDF_SURFACE, false)
-else
- PDF_SURFACE_FEATURE=CAIRO_HAS_PDF_SURFACE
+AM_CONDITIONAL(CAIRO_HAS_PDF_SURFACE, test "x$use_pdf" = "xyes")
+if test "x$use_pdf" = "xyes"; then
+ PDF_SURFACE_FEATURE=1
PDF_LIBS=-lz
- AM_CONDITIONAL(CAIRO_HAS_PDF_SURFACE, true)
+else
+ PDF_SURFACE_FEATURE=0
fi
+AC_SUBST(PDF_SURFACE_FEATURE)
CAIRO_LIBS="$CAIRO_LIBS $PDF_LIBS"
-AC_SUBST(PDF_SURFACE_FEATURE)
AC_SUBST(PDF_LIBS)
dnl ===========================================================================
@@ -387,12 +361,11 @@ if test "x$use_atsui" = "xyes"; then
AC_CHECK_HEADER(Carbon/Carbon.h, [use_atsui=yes], [use_atsui=no])
fi
-if test "x$use_atsui" != "xyes"; then
- ATSUI_FONT_FEATURE=CAIRO_HAS_NO_ATSUI_FONT
- AM_CONDITIONAL(CAIRO_HAS_ATSUI_FONT, false)
+AM_CONDITIONAL(CAIRO_HAS_ATSUI_FONT, test "x$use_atsui" = "xyes")
+if test "x$use_atsui" = "xyes"; then
+ ATSUI_FONT_FEATURE=1
else
- ATSUI_FONT_FEATURE=CAIRO_HAS_ATSUI_FONT
- AM_CONDITIONAL(CAIRO_HAS_ATSUI_FONT, true)
+ ATSUI_FONT_FEATURE=0
fi
AC_SUBST(ATSUI_FONT_FEATURE)
diff --git a/src/cairo-atsui.h b/src/cairo-atsui.h
index a5b7308f..3a79ef4a 100644
--- a/src/cairo-atsui.h
+++ b/src/cairo-atsui.h
@@ -38,7 +38,7 @@
#include <cairo.h>
-#ifdef CAIRO_HAS_ATSUI_FONT
+#if CAIRO_HAS_ATSUI_FONT
/* ATSUI platform-specific font interface */
diff --git a/src/cairo-cache.c b/src/cairo-cache.c
index 0c8884bc..e9589496 100644
--- a/src/cairo-cache.c
+++ b/src/cairo-cache.c
@@ -113,7 +113,9 @@ static const cairo_cache_arrangement_t cache_arrangements [] = {
#define LIVE_ENTRY_P(cache, i) \
(!((NULL_ENTRY_P((cache),(i))) || (DEAD_ENTRY_P((cache),(i)))))
-#ifdef CAIRO_DO_SANITY_CHECKING
+#ifdef NDEBUG
+#define _cache_sane_state(c)
+#else
static void
_cache_sane_state (cairo_cache_t *cache)
{
@@ -125,8 +127,6 @@ _cache_sane_state (cairo_cache_t *cache)
/* assert (cache->used_memory <= cache->max_memory); */
assert (cache->live_entries <= cache->arrangement->size);
}
-#else
-#define _cache_sane_state(c)
#endif
static void
diff --git a/src/cairo-features.h.in b/src/cairo-features.h.in
index 05151b5f..cc3d3e70 100644
--- a/src/cairo-features.h.in
+++ b/src/cairo-features.h.in
@@ -37,28 +37,26 @@
#ifndef CAIRO_FEATURES_H
#define CAIRO_FEATURES_H
-#define @PS_SURFACE_FEATURE@
+#define CAIRO_HAS_PS_SURFACE @PS_SURFACE_FEATURE@
-#define @PDF_SURFACE_FEATURE@
+#define CAIRO_HAS_PDF_SURFACE @PDF_SURFACE_FEATURE@
-#define @XLIB_SURFACE_FEATURE@
+#define CAIRO_HAS_XLIB_SURFACE @XLIB_SURFACE_FEATURE@
-#define @QUARTZ_SURFACE_FEATURE@
+#define CAIRO_HAS_QUARTZ_SURFACE @QUARTZ_SURFACE_FEATURE@
-#define @XCB_SURFACE_FEATURE@
+#define CAIRO_HAS_XCB_SURFACE @XCB_SURFACE_FEATURE@
-#define @WIN32_SURFACE_FEATURE@
+#define CAIRO_HAS_WIN32_SURFACE @WIN32_SURFACE_FEATURE@
-#define @GLITZ_SURFACE_FEATURE@
+#define CAIRO_HAS_GLITZ_SURFACE @GLITZ_SURFACE_FEATURE@
-#define @FT_FONT_FEATURE@
+#define CAIRO_HAS_FT_FONT @FT_FONT_FEATURE@
-#define @WIN32_FONT_FEATURE@
+#define CAIRO_HAS_WIN32_FONT @WIN32_FONT_FEATURE@
-#define @ATSUI_FONT_FEATURE@
+#define CAIRO_HAS_ATSUI_FONT @ATSUI_FONT_FEATURE@
-#define @PNG_FUNCTIONS_FEATURE@
-
-#define @SANITY_CHECKING_FEATURE@
+#define CAIRO_HAS_PNG_FUNCTIONS @PNG_FUNCTIONS_FEATURE@
#endif
diff --git a/src/cairo-ft-private.h b/src/cairo-ft-private.h
index b2176352..494d8369 100644
--- a/src/cairo-ft-private.h
+++ b/src/cairo-ft-private.h
@@ -40,7 +40,7 @@
#include <cairo-ft.h>
#include <cairoint.h>
-#ifdef CAIRO_HAS_FT_FONT
+#if CAIRO_HAS_FT_FONT
CAIRO_BEGIN_DECLS
diff --git a/src/cairo-ft.h b/src/cairo-ft.h
index 07142999..506e61f4 100644
--- a/src/cairo-ft.h
+++ b/src/cairo-ft.h
@@ -39,7 +39,7 @@
#include <cairo.h>
-#ifdef CAIRO_HAS_FT_FONT
+#if CAIRO_HAS_FT_FONT
/* Fontconfig/Freetype platform-specific font interface */
diff --git a/src/cairo-glitz.h b/src/cairo-glitz.h
index 33620c07..bf812487 100644
--- a/src/cairo-glitz.h
+++ b/src/cairo-glitz.h
@@ -39,7 +39,7 @@
#include <cairo.h>
-#ifdef CAIRO_HAS_GLITZ_SURFACE
+#if CAIRO_HAS_GLITZ_SURFACE
#include <glitz.h>
diff --git a/src/cairo-hash.c b/src/cairo-hash.c
index 0c8884bc..e9589496 100644
--- a/src/cairo-hash.c
+++ b/src/cairo-hash.c
@@ -113,7 +113,9 @@ static const cairo_cache_arrangement_t cache_arrangements [] = {
#define LIVE_ENTRY_P(cache, i) \
(!((NULL_ENTRY_P((cache),(i))) || (DEAD_ENTRY_P((cache),(i)))))
-#ifdef CAIRO_DO_SANITY_CHECKING
+#ifdef NDEBUG
+#define _cache_sane_state(c)
+#else
static void
_cache_sane_state (cairo_cache_t *cache)
{
@@ -125,8 +127,6 @@ _cache_sane_state (cairo_cache_t *cache)
/* assert (cache->used_memory <= cache->max_memory); */
assert (cache->live_entries <= cache->arrangement->size);
}
-#else
-#define _cache_sane_state(c)
#endif
static void
diff --git a/src/cairo-pdf.h b/src/cairo-pdf.h
index 3dc1845d..8c31636b 100644
--- a/src/cairo-pdf.h
+++ b/src/cairo-pdf.h
@@ -39,7 +39,7 @@
#include <cairo.h>
-#ifdef CAIRO_HAS_PDF_SURFACE
+#if CAIRO_HAS_PDF_SURFACE
#include <stdio.h>
diff --git a/src/cairo-ps.h b/src/cairo-ps.h
index e375398b..a0a7cd56 100644
--- a/src/cairo-ps.h
+++ b/src/cairo-ps.h
@@ -39,7 +39,7 @@
#include <cairo.h>
-#ifdef CAIRO_HAS_PS_SURFACE
+#if CAIRO_HAS_PS_SURFACE
#include <stdio.h>
diff --git a/src/cairo-quartz.h b/src/cairo-quartz.h
index 006aee7b..7ba35eef 100644
--- a/src/cairo-quartz.h
+++ b/src/cairo-quartz.h
@@ -39,7 +39,7 @@
#include <cairo.h>
-#ifdef CAIRO_HAS_QUARTZ_SURFACE
+#if CAIRO_HAS_QUARTZ_SURFACE
#include <Carbon/Carbon.h>
diff --git a/src/cairo-win32.h b/src/cairo-win32.h
index 521fee74..29197b9e 100644
--- a/src/cairo-win32.h
+++ b/src/cairo-win32.h
@@ -38,7 +38,7 @@
#include <cairo.h>
-#ifdef CAIRO_HAS_WIN32_SURFACE
+#if CAIRO_HAS_WIN32_SURFACE
#include <windows.h>
diff --git a/src/cairo-xcb.h b/src/cairo-xcb.h
index b7625b18..f0728ff5 100644
--- a/src/cairo-xcb.h
+++ b/src/cairo-xcb.h
@@ -39,7 +39,7 @@
#include <cairo.h>
-#ifdef CAIRO_HAS_XCB_SURFACE
+#if CAIRO_HAS_XCB_SURFACE
#include <X11/XCB/xcb.h>
#include <X11/XCB/render.h>
diff --git a/src/cairo-xlib.h b/src/cairo-xlib.h
index 9c574ea3..e4483b64 100644
--- a/src/cairo-xlib.h
+++ b/src/cairo-xlib.h
@@ -39,7 +39,7 @@
#include <cairo.h>
-#ifdef CAIRO_HAS_XLIB_SURFACE
+#if CAIRO_HAS_XLIB_SURFACE
#include <X11/Xlib.h>
#include <X11/extensions/Xrender.h>
diff --git a/src/cairo.c b/src/cairo.c
index 09adac51..e8d9208a 100644
--- a/src/cairo.c
+++ b/src/cairo.c
@@ -43,8 +43,10 @@
#define CAIRO_TOLERANCE_MINIMUM 0.0002 /* We're limited by 16 bits of sub-pixel precision */
-#ifdef CAIRO_DO_SANITY_CHECKING
#include <assert.h>
+#ifdef NDEBUG
+#define CAIRO_CHECK_SANITY(cr)
+#else
static int
cairo_sane_state (cairo_t *cr)
{
@@ -69,11 +71,8 @@ cairo_sane_state (cairo_t *cr)
return 1;
}
#define CAIRO_CHECK_SANITY(cr) assert(cairo_sane_state ((cr)))
-#else
-#define CAIRO_CHECK_SANITY(cr)
#endif
-
/*
* cairo_create:
* @target: target surface for the context
diff --git a/src/cairo.h b/src/cairo.h
index 79aa17e1..38e0d859 100644
--- a/src/cairo.h
+++ b/src/cairo.h
@@ -934,7 +934,7 @@ cairo_surface_destroy (cairo_surface_t *surface);
cairo_status_t
cairo_surface_finish (cairo_surface_t *surface);
-#ifdef CAIRO_HAS_PNG_FUNCTIONS
+#if CAIRO_HAS_PNG_FUNCTIONS
cairo_status_t
cairo_surface_write_to_png (cairo_surface_t *surface,
@@ -982,7 +982,7 @@ cairo_image_surface_get_width (cairo_surface_t *surface);
int
cairo_image_surface_get_height (cairo_surface_t *surface);
-#ifdef CAIRO_HAS_PNG_FUNCTIONS
+#if CAIRO_HAS_PNG_FUNCTIONS
cairo_surface_t *
cairo_image_surface_create_from_png (const char *filename);
diff --git a/src/cairoint.h b/src/cairoint.h
index cb615763..c3a2bc50 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -545,19 +545,19 @@ struct _cairo_font_face_backend {
};
/* concrete font backends */
-#ifdef CAIRO_HAS_FT_FONT
+#if CAIRO_HAS_FT_FONT
extern const cairo_private struct _cairo_scaled_font_backend cairo_ft_scaled_font_backend;
#endif
-#ifdef CAIRO_HAS_WIN32_FONT
+#if CAIRO_HAS_WIN32_FONT
extern const cairo_private struct _cairo_scaled_font_backend cairo_win32_scaled_font_backend;
#endif
-#ifdef CAIRO_HAS_ATSUI_FONT
+#if CAIRO_HAS_ATSUI_FONT
extern const cairo_private struct _cairo_scaled_font_backend cairo_atsui_scaled_font_backend;
@@ -853,17 +853,17 @@ typedef struct _cairo_traps {
#define CAIRO_FONT_SLANT_DEFAULT CAIRO_FONT_SLANT_NORMAL
#define CAIRO_FONT_WEIGHT_DEFAULT CAIRO_FONT_WEIGHT_NORMAL
-#if defined (CAIRO_HAS_WIN32_FONT)
+#if CAIRO_HAS_WIN32_FONT
#define CAIRO_FONT_FAMILY_DEFAULT "Arial"
#define CAIRO_FONT_BACKEND_DEFAULT &cairo_win32_scaled_font_backend
-#elif defined (CAIRO_HAS_ATSUI_FONT)
+#elif CAIRO_HAS_ATSUI_FONT
#define CAIRO_FONT_FAMILY_DEFAULT "Monaco"
#define CAIRO_FONT_BACKEND_DEFAULT &cairo_atsui_scaled_font_backend
-#elif defined (CAIRO_HAS_FT_FONT)
+#elif CAIRO_HAS_FT_FONT
#define CAIRO_FONT_FAMILY_DEFAULT "serif"
#define CAIRO_FONT_BACKEND_DEFAULT &cairo_ft_scaled_font_backend
diff --git a/test/cairo-test.c b/test/cairo-test.c
index bce61240..1330abb4 100644
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -146,7 +146,7 @@ cleanup_glitz (cairo_t *cr)
}
#endif
-#ifdef CAIRO_HAS_QUARTZ_SURFACE
+#if CAIRO_HAS_QUARTZ_SURFACE
static cairo_surface_t *
create_quartz_surface (int width, int height, void **closure)
{
@@ -160,7 +160,7 @@ cleanup_quartz (void *closure)
}
#endif
-#ifdef CAIRO_HAS_WIN32_SURFACE
+#if CAIRO_HAS_WIN32_SURFACE
static cairo_surface_t *
create_win32_surface (int width, int height, void **closure)
{
@@ -174,7 +174,7 @@ cleanup_win32 (void *closure)
}
#endif
-#ifdef CAIRO_HAS_XCB_SURFACE
+#if CAIRO_HAS_XCB_SURFACE
static cairo_surface_t *
create_xcb_surface (int width, int height, void **closure)
{
@@ -188,7 +188,7 @@ cleanup_xcb (void *closure)
}
#endif
-#ifdef CAIRO_HAS_XLIB_SURFACE
+#if CAIRO_HAS_XLIB_SURFACE
typedef struct _xlib_target_closure
{
Display *dpy;
@@ -332,16 +332,16 @@ cairo_test_real (cairo_test_t *test, cairo_test_draw_function_t draw)
#if 0 /* #ifdef CAIRO_HAS_GLITZ_SURFACE */
{ "glitz", create_glitz_surface, cleanup_glitz},
#endif
-#ifdef CAIRO_HAS_QUARTZ_SURFACE
+#if CAIRO_HAS_QUARTZ_SURFACE
{ "quartz", create_quartz_surface, cleanup_quartz},
#endif
-#ifdef CAIRO_HAS_WIN32_SURFACE
+#if CAIRO_HAS_WIN32_SURFACE
{ "win32", create_win32_surface, cleanup_win32},
#endif
-#ifdef CAIRO_HAS_XCB_SURFACE
+#if CAIRO_HAS_XCB_SURFACE
{ "xcb", create_xcb_surface, cleanup_xcb},
#endif
-#ifdef CAIRO_HAS_XLIB_SURFACE
+#if CAIRO_HAS_XLIB_SURFACE
{ "xlib", create_xlib_surface, cleanup_xlib},
#endif
};
diff --git a/util/cairo-api-update b/util/cairo-api-update
index 76480848..e9752d4a 100755
--- a/util/cairo-api-update
+++ b/util/cairo-api-update
@@ -51,6 +51,7 @@ cairo_api_update() {
s/CAIRO_OPERATOR_IN_REVERSE/CAIRO_OPERATOR_DEST_IN/g
s/CAIRO_OPERATOR_OUT_REVERSE/CAIRO_OPERATOR_DEST_OUT/g
s/CAIRO_OPERATOR_ATOP_REVERSE/CAIRO_OPERATOR_DEST_ATOP/g
+ s/^#\([ ]*\)ifdef[ ]*CAIRO_HAS/#\1if CAIRO_HAS/g
' $backup > $file
}