[cairo-commit] src/cairo-base85-stream.c src/cairo.c src/cairo-clip-private.h src/cairo-deflate-stream.c src/cairo-font-options.c src/cairoint.h src/cairo-output-stream.c src/cairo-output-stream-private.h src/cairo-pattern.c src/cairo-ps-surface.c

Behdad Esfahbod behdad at kemper.freedesktop.org
Tue Apr 3 16:26:11 PDT 2007


 src/cairo-base85-stream.c         |    2 +-
 src/cairo-clip-private.h          |    2 +-
 src/cairo-deflate-stream.c        |    4 ++--
 src/cairo-font-options.c          |   22 +++++++++++-----------
 src/cairo-output-stream-private.h |    2 +-
 src/cairo-output-stream.c         |   20 ++++++++++----------
 src/cairo-pattern.c               |   14 +++++++-------
 src/cairo-ps-surface.c            |    4 ++--
 src/cairo.c                       |    8 ++++----
 src/cairoint.h                    |    2 +-
 10 files changed, 40 insertions(+), 40 deletions(-)

New commits:
diff-tree 88dc0c5f19475888c19db437661b290f3a8902f8 (from 114be945db6c02aeb60cf1123b43680bd12cccdb)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Apr 3 19:26:18 2007 -0400

    Make sure all nil objects start with _cairo_
    
    Previously, the convention was that static ones started with cairo_, but
    renamed to start with _cairo_ when they were needed from other files and
    became cairo_private instead of static...
    
    This is error prune indeed, and two symbols were already violating.  Now
    all nil objects start with _cairo_.

diff --git a/src/cairo-base85-stream.c b/src/cairo-base85-stream.c
index 7163d00..08ae8a7 100644
--- a/src/cairo-base85-stream.c
+++ b/src/cairo-base85-stream.c
@@ -115,7 +115,7 @@ _cairo_base85_stream_create (cairo_outpu
 
     stream = malloc (sizeof (cairo_base85_stream_t));
     if (stream == NULL)
-	return (cairo_output_stream_t *) &cairo_output_stream_nil;
+	return (cairo_output_stream_t *) &_cairo_output_stream_nil;
 
     _cairo_output_stream_init (&stream->base,
 			       _cairo_base85_stream_write,
diff --git a/src/cairo-clip-private.h b/src/cairo-clip-private.h
index 3c4ff0d..d2811d5 100644
--- a/src/cairo-clip-private.h
+++ b/src/cairo-clip-private.h
@@ -38,7 +38,7 @@
 
 #include "cairo-path-fixed-private.h"
 
-extern cairo_private const cairo_rectangle_list_t _cairo_rectangles_nil;
+extern const cairo_private cairo_rectangle_list_t _cairo_rectangles_nil;
 
 struct _cairo_clip_path {
     unsigned int	ref_count;
diff --git a/src/cairo-deflate-stream.c b/src/cairo-deflate-stream.c
index 816f5c5..563c7be 100644
--- a/src/cairo-deflate-stream.c
+++ b/src/cairo-deflate-stream.c
@@ -119,7 +119,7 @@ _cairo_deflate_stream_create (cairo_outp
 
     stream = malloc (sizeof (cairo_deflate_stream_t));
     if (stream == NULL)
-	return (cairo_output_stream_t *) &cairo_output_stream_nil;
+	return (cairo_output_stream_t *) &_cairo_output_stream_nil;
 
     _cairo_output_stream_init (&stream->base,
 			       _cairo_deflate_stream_write,
@@ -131,7 +131,7 @@ _cairo_deflate_stream_create (cairo_outp
     stream->zlib_stream.opaque  = Z_NULL;
 
     if (deflateInit (&stream->zlib_stream, Z_DEFAULT_COMPRESSION) != Z_OK)
-	return (cairo_output_stream_t *) &cairo_output_stream_nil;
+	return (cairo_output_stream_t *) &_cairo_output_stream_nil;
 
     stream->zlib_stream.next_in = stream->input_buf;
     stream->zlib_stream.avail_in = 0;
diff --git a/src/cairo-font-options.c b/src/cairo-font-options.c
index 316299b..ccdffa9 100644
--- a/src/cairo-font-options.c
+++ b/src/cairo-font-options.c
@@ -36,7 +36,7 @@
 
 #include "cairoint.h"
 
-static const cairo_font_options_t cairo_font_options_nil = {
+static const cairo_font_options_t _cairo_font_options_nil = {
     CAIRO_ANTIALIAS_DEFAULT,
     CAIRO_SUBPIXEL_ORDER_DEFAULT,
     CAIRO_HINT_STYLE_DEFAULT,
@@ -52,7 +52,7 @@ static const cairo_font_options_t cairo_
 void
 _cairo_font_options_init_default (cairo_font_options_t *options)
 {
-    if (options == (cairo_font_options_t *)&cairo_font_options_nil)
+    if (options == (cairo_font_options_t *)&_cairo_font_options_nil)
 	return;
 
     options->antialias = CAIRO_ANTIALIAS_DEFAULT;
@@ -89,7 +89,7 @@ cairo_font_options_create (void)
     cairo_font_options_t *options = malloc (sizeof (cairo_font_options_t));
 
     if (!options)
-	return (cairo_font_options_t *)&cairo_font_options_nil;
+	return (cairo_font_options_t *)&_cairo_font_options_nil;
 
     _cairo_font_options_init_default (options);
 
@@ -116,7 +116,7 @@ cairo_font_options_copy (const cairo_fon
     cairo_font_options_t *options = malloc (sizeof (cairo_font_options_t));
 
     if (!options)
-	return (cairo_font_options_t *)&cairo_font_options_nil;
+	return (cairo_font_options_t *)&_cairo_font_options_nil;
 
     _cairo_font_options_init_copy (options, original);
 
@@ -133,7 +133,7 @@ cairo_font_options_copy (const cairo_fon
 void
 cairo_font_options_destroy (cairo_font_options_t *options)
 {
-    if (options == (cairo_font_options_t *)&cairo_font_options_nil)
+    if (options == (cairo_font_options_t *)&_cairo_font_options_nil)
 	return;
 
     free (options);
@@ -152,7 +152,7 @@ slim_hidden_def (cairo_font_options_dest
 cairo_status_t
 cairo_font_options_status (cairo_font_options_t *options)
 {
-    if (options == (cairo_font_options_t *)&cairo_font_options_nil)
+    if (options == (cairo_font_options_t *)&_cairo_font_options_nil)
 	return CAIRO_STATUS_NO_MEMORY;
     else
 	return CAIRO_STATUS_SUCCESS;
@@ -172,7 +172,7 @@ void
 cairo_font_options_merge (cairo_font_options_t       *options,
 			  const cairo_font_options_t *other)
 {
-    if (options == (cairo_font_options_t *)&cairo_font_options_nil)
+    if (options == (cairo_font_options_t *)&_cairo_font_options_nil)
 	return;
 
     if (other->antialias != CAIRO_ANTIALIAS_DEFAULT)
@@ -240,7 +240,7 @@ void
 cairo_font_options_set_antialias (cairo_font_options_t *options,
 				  cairo_antialias_t     antialias)
 {
-    if (options == (cairo_font_options_t *)&cairo_font_options_nil)
+    if (options == (cairo_font_options_t *)&_cairo_font_options_nil)
 	return;
 
     options->antialias = antialias;
@@ -276,7 +276,7 @@ void
 cairo_font_options_set_subpixel_order (cairo_font_options_t   *options,
 				       cairo_subpixel_order_t  subpixel_order)
 {
-    if (options == (cairo_font_options_t *)&cairo_font_options_nil)
+    if (options == (cairo_font_options_t *)&_cairo_font_options_nil)
 	return;
 
     options->subpixel_order = subpixel_order;
@@ -312,7 +312,7 @@ void
 cairo_font_options_set_hint_style (cairo_font_options_t *options,
 				   cairo_hint_style_t    hint_style)
 {
-    if (options == (cairo_font_options_t *)&cairo_font_options_nil)
+    if (options == (cairo_font_options_t *)&_cairo_font_options_nil)
 	return;
 
     options->hint_style = hint_style;
@@ -348,7 +348,7 @@ void
 cairo_font_options_set_hint_metrics (cairo_font_options_t *options,
 				     cairo_hint_metrics_t  hint_metrics)
 {
-    if (options == (cairo_font_options_t *)&cairo_font_options_nil)
+    if (options == (cairo_font_options_t *)&_cairo_font_options_nil)
 	return;
 
     options->hint_metrics = hint_metrics;
diff --git a/src/cairo-output-stream-private.h b/src/cairo-output-stream-private.h
index d68fbb4..0d5d29c 100644
--- a/src/cairo-output-stream-private.h
+++ b/src/cairo-output-stream-private.h
@@ -53,7 +53,7 @@ struct _cairo_output_stream {
     cairo_bool_t		     closed;
 };
 
-extern const cairo_private cairo_output_stream_t cairo_output_stream_nil;
+extern const cairo_private cairo_output_stream_t _cairo_output_stream_nil;
 
 cairo_private void
 _cairo_output_stream_init (cairo_output_stream_t            *stream,
diff --git a/src/cairo-output-stream.c b/src/cairo-output-stream.c
index 71f2693..341a93a 100644
--- a/src/cairo-output-stream.c
+++ b/src/cairo-output-stream.c
@@ -63,7 +63,7 @@ _cairo_output_stream_fini (cairo_output_
     return _cairo_output_stream_close (stream);
 }
 
-const cairo_output_stream_t cairo_output_stream_nil = {
+const cairo_output_stream_t _cairo_output_stream_nil = {
     NULL, /* write_func */
     NULL, /* close_func */
     0,    /* position */
@@ -71,7 +71,7 @@ const cairo_output_stream_t cairo_output
     FALSE /* closed */
 };
 
-static const cairo_output_stream_t cairo_output_stream_nil_write_error = {
+static const cairo_output_stream_t _cairo_output_stream_nil_write_error = {
     NULL, /* write_func */
     NULL, /* close_func */
     0,    /* position */
@@ -119,7 +119,7 @@ _cairo_output_stream_create (cairo_write
 
     stream = malloc (sizeof (cairo_output_stream_with_closure_t));
     if (stream == NULL)
-	return (cairo_output_stream_t *) &cairo_output_stream_nil;
+	return (cairo_output_stream_t *) &_cairo_output_stream_nil;
 
     _cairo_output_stream_init (&stream->base, closure_write, closure_close);
     stream->write_func = write_func;
@@ -137,8 +137,8 @@ _cairo_output_stream_close (cairo_output
     if (stream->closed)
 	return stream->status;
 
-    if (stream == &cairo_output_stream_nil ||
-	stream == &cairo_output_stream_nil_write_error)
+    if (stream == &_cairo_output_stream_nil ||
+	stream == &_cairo_output_stream_nil_write_error)
     {
 	return stream->status;
     }
@@ -444,11 +444,11 @@ _cairo_output_stream_create_for_file (FI
     stdio_stream_t *stream;
 
     if (file == NULL)
-	return (cairo_output_stream_t *) &cairo_output_stream_nil_write_error;
+	return (cairo_output_stream_t *) &_cairo_output_stream_nil_write_error;
 
     stream = malloc (sizeof *stream);
     if (stream == NULL)
-	return (cairo_output_stream_t *) &cairo_output_stream_nil;
+	return (cairo_output_stream_t *) &_cairo_output_stream_nil;
 
     _cairo_output_stream_init (&stream->base, stdio_write, stdio_flush);
     stream->file = file;
@@ -464,12 +464,12 @@ _cairo_output_stream_create_for_filename
 
     file = fopen (filename, "wb");
     if (file == NULL)
-	return (cairo_output_stream_t *) &cairo_output_stream_nil_write_error;
+	return (cairo_output_stream_t *) &_cairo_output_stream_nil_write_error;
 
     stream = malloc (sizeof *stream);
     if (stream == NULL) {
 	fclose (file);
-	return (cairo_output_stream_t *) &cairo_output_stream_nil;
+	return (cairo_output_stream_t *) &_cairo_output_stream_nil;
     }
 
     _cairo_output_stream_init (&stream->base, stdio_write, stdio_close);
@@ -510,7 +510,7 @@ _cairo_memory_stream_create (void)
 
     stream = malloc (sizeof *stream);
     if (stream == NULL)
-	return (cairo_output_stream_t *) &cairo_output_stream_nil;
+	return (cairo_output_stream_t *) &_cairo_output_stream_nil;
 
     _cairo_output_stream_init (&stream->base, memory_write, memory_close);
     _cairo_array_init (&stream->array, 1);
diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c
index 2bc5580..80acdad 100644
--- a/src/cairo-pattern.c
+++ b/src/cairo-pattern.c
@@ -30,7 +30,7 @@
 
 #include "cairoint.h"
 
-const cairo_solid_pattern_t cairo_pattern_nil = {
+const cairo_solid_pattern_t _cairo_pattern_nil = {
     { CAIRO_PATTERN_TYPE_SOLID, 	/* type */
       CAIRO_REF_COUNT_INVALID,		/* ref_count */
       CAIRO_STATUS_NO_MEMORY,	/* status */
@@ -40,7 +40,7 @@ const cairo_solid_pattern_t cairo_patter
       CAIRO_EXTEND_GRADIENT_DEFAULT },	/* extend */
 };
 
-static const cairo_solid_pattern_t cairo_pattern_nil_null_pointer = {
+static const cairo_solid_pattern_t _cairo_pattern_nil_null_pointer = {
     { CAIRO_PATTERN_TYPE_SOLID, 	/* type */
       CAIRO_REF_COUNT_INVALID,		/* ref_count */
       CAIRO_STATUS_NULL_POINTER,/* status */
@@ -310,7 +310,7 @@ _cairo_pattern_create_solid (const cairo
 
     pattern = _cairo_pattern_create_solid_from_cache (color);
     if (pattern == NULL)
-	return (cairo_pattern_t *) &cairo_pattern_nil.base;
+	return (cairo_pattern_t *) &_cairo_pattern_nil.base;
 
     return pattern;
 }
@@ -449,7 +449,7 @@ cairo_pattern_create_for_surface (cairo_
     cairo_surface_pattern_t *pattern;
 
     if (surface == NULL)
-	return (cairo_pattern_t*) &cairo_pattern_nil_null_pointer;
+	return (cairo_pattern_t*) &_cairo_pattern_nil_null_pointer;
 
     if (surface->status)
 	return (cairo_pattern_t*) _cairo_pattern_create_in_error (surface->status);
@@ -457,7 +457,7 @@ cairo_pattern_create_for_surface (cairo_
     pattern = malloc (sizeof (cairo_surface_pattern_t));
     if (pattern == NULL) {
 	_cairo_error (CAIRO_STATUS_NO_MEMORY);
-	return (cairo_pattern_t *)&cairo_pattern_nil.base;
+	return (cairo_pattern_t *)&_cairo_pattern_nil.base;
     }
 
     _cairo_pattern_init_for_surface (pattern, surface);
@@ -500,7 +500,7 @@ cairo_pattern_create_linear (double x0, 
     pattern = malloc (sizeof (cairo_linear_pattern_t));
     if (pattern == NULL) {
 	_cairo_error (CAIRO_STATUS_NO_MEMORY);
-	return (cairo_pattern_t *) &cairo_pattern_nil.base;
+	return (cairo_pattern_t *) &_cairo_pattern_nil.base;
     }
 
     _cairo_pattern_init_linear (pattern, x0, y0, x1, y1);
@@ -545,7 +545,7 @@ cairo_pattern_create_radial (double cx0,
     pattern = malloc (sizeof (cairo_radial_pattern_t));
     if (pattern == NULL) {
 	_cairo_error (CAIRO_STATUS_NO_MEMORY);
-	return (cairo_pattern_t *) &cairo_pattern_nil.base;
+	return (cairo_pattern_t *) &_cairo_pattern_nil.base;
     }
 
     _cairo_pattern_init_radial (pattern, cx0, cy0, radius0, cx1, cy1, radius1);
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index 84427e5..52efc83 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -182,7 +182,7 @@ _word_wrap_stream_create (cairo_output_s
 
     stream = malloc (sizeof (word_wrap_stream_t));
     if (stream == NULL)
-	return (cairo_output_stream_t *) &cairo_output_stream_nil;
+	return (cairo_output_stream_t *) &_cairo_output_stream_nil;
 
     _cairo_output_stream_init (&stream->base,
 			       _word_wrap_stream_write,
@@ -1542,7 +1542,7 @@ _string_array_stream_create (cairo_outpu
 
     stream = malloc (sizeof (string_array_stream_t));
     if (stream == NULL)
-	return (cairo_output_stream_t *) &cairo_output_stream_nil;
+	return (cairo_output_stream_t *) &_cairo_output_stream_nil;
 
     _cairo_output_stream_init (&stream->base,
 			       _string_array_stream_write,
diff --git a/src/cairo.c b/src/cairo.c
index cbd6615..bf61596 100644
--- a/src/cairo.c
+++ b/src/cairo.c
@@ -44,7 +44,7 @@
 
 #define CAIRO_TOLERANCE_MINIMUM	0.0002 /* We're limited by 16 bits of sub-pixel precision */
 
-static const cairo_t cairo_nil = {
+static const cairo_t _cairo_nil = {
   CAIRO_REF_COUNT_INVALID,	/* ref_count */
   CAIRO_STATUS_NO_MEMORY,	/* status */
   { 0, 0, 0, NULL },		/* user_data */
@@ -192,7 +192,7 @@ cairo_create (cairo_surface_t *target)
 
     cr = malloc (sizeof (cairo_t));
     if (cr == NULL)
-	return (cairo_t *) &cairo_nil;
+	return (cairo_t *) &_cairo_nil;
 
     cr->ref_count = 1;
 
@@ -548,7 +548,7 @@ cairo_pop_group (cairo_t *cr)
     cairo_matrix_t group_matrix;
 
     if (cr->status)
-	return (cairo_pattern_t*) &cairo_pattern_nil.base;
+	return (cairo_pattern_t*) &_cairo_pattern_nil.base;
 
     /* Grab the active surfaces */
     group_surface = _cairo_gstate_get_target (cr->gstate);
@@ -816,7 +816,7 @@ cairo_pattern_t *
 cairo_get_source (cairo_t *cr)
 {
     if (cr->status)
-	return (cairo_pattern_t*) &cairo_pattern_nil.base;
+	return (cairo_pattern_t*) &_cairo_pattern_nil.base;
 
     return _cairo_gstate_get_source (cr->gstate);
 }
diff --git a/src/cairoint.h b/src/cairoint.h
index 1d2c3c7..c462975 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -1092,7 +1092,7 @@ typedef struct _cairo_solid_pattern {
     cairo_color_t color;
 } cairo_solid_pattern_t;
 
-extern const cairo_private cairo_solid_pattern_t cairo_pattern_nil;
+extern const cairo_private cairo_solid_pattern_t _cairo_pattern_nil;
 extern const cairo_private cairo_solid_pattern_t cairo_pattern_none;
 
 typedef struct _cairo_surface_pattern {


More information about the cairo-commit mailing list