diff options
author | Andrea Canciani <ranma42@gmail.com> | 2011-07-03 18:40:08 +0200 |
---|---|---|
committer | Andrea Canciani <ranma42@gmail.com> | 2011-07-05 10:00:13 +0200 |
commit | fe3ca9c36f15403d8d93263acb758100836ad3cb (patch) | |
tree | 59bcb743e86284f75ef42bd327f6fed701ce7ff5 | |
parent | b6c972897b9d7cb898fb08363115e721a3ff758c (diff) |
Remove conditional compilation of freed-pools
Conditional compilation was needed to avoid warnings:
cairo-clip.c:51: warning: ‘clip_path_pool’ defined but not used
cairo.c:181: warning: ‘context_pool’ defined but not used
They can be avoided by making sure that _freed_pool_reset(ptr)
actually consumes its argument. This has the pleasant side-effect that
forgetting to properly reset a freed-pool now results in a warning if
atomic ops are disabled/not available.
-rw-r--r-- | src/cairo-clip.c | 2 | ||||
-rw-r--r-- | src/cairo-freed-pool-private.h | 6 | ||||
-rw-r--r-- | src/cairo-pattern.c | 4 | ||||
-rw-r--r-- | src/cairo.c | 3 |
4 files changed, 5 insertions, 10 deletions
diff --git a/src/cairo-clip.c b/src/cairo-clip.c index 9527c599..d78a17c2 100644 --- a/src/cairo-clip.c +++ b/src/cairo-clip.c @@ -48,9 +48,7 @@ #include "cairo-composite-rectangles-private.h" #include "cairo-region-private.h" -#if HAS_FREED_POOL static freed_pool_t clip_path_pool; -#endif static cairo_clip_path_t * _cairo_clip_path_create (cairo_clip_t *clip) diff --git a/src/cairo-freed-pool-private.h b/src/cairo-freed-pool-private.h index 0a4ab0ee..f0549e64 100644 --- a/src/cairo-freed-pool-private.h +++ b/src/cairo-freed-pool-private.h @@ -118,11 +118,15 @@ _freed_pool_reset (freed_pool_t *pool); #else +/* A warning about an unused freed-pool in a build without atomics + * enabled usually indicates a missing _freed_pool_reset() in the + * static reset function */ + typedef int freed_pool_t; #define _freed_pool_get(pool) NULL #define _freed_pool_put(pool, ptr) free(ptr) -#define _freed_pool_reset(ptr) +#define _freed_pool_reset(ptr) assert((ptr) != NULL) #endif diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c index 8531aa5e..1e9326d3 100644 --- a/src/cairo-pattern.c +++ b/src/cairo-pattern.c @@ -56,9 +56,7 @@ * functions. */ -#if HAS_FREED_POOL static freed_pool_t freed_pattern_pool[5]; -#endif static const cairo_solid_pattern_t _cairo_pattern_nil = { { CAIRO_PATTERN_TYPE_SOLID, /* type */ @@ -5160,12 +5158,10 @@ slim_hidden_def (cairo_mesh_pattern_get_control_point); void _cairo_pattern_reset_static_data (void) { -#if HAS_FREED_POOL int i; for (i = 0; i < ARRAY_LENGTH (freed_pattern_pool); i++) _freed_pool_reset (&freed_pattern_pool[i]); -#endif _cairo_pattern_reset_solid_surface_cache (); } diff --git a/src/cairo.c b/src/cairo.c index 42afe26a..32a1f9c6 100644 --- a/src/cairo.c +++ b/src/cairo.c @@ -178,10 +178,7 @@ _cairo_set_error (cairo_t *cr, cairo_status_t status) _cairo_status_set_error (&cr->status, _cairo_error (status)); } -#if HAS_FREED_POOL static freed_pool_t context_pool; -#endif - /* XXX This should disappear in favour of a common pool of error objects. */ static cairo_t *_cairo_nil__objects[CAIRO_STATUS_LAST_STATUS + 1]; |