diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2009-05-26 12:46:46 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2009-06-01 18:04:14 +0100 |
commit | 45835f623f5ddda6e3258361b9d6ab27860a9198 (patch) | |
tree | 61eb10584e29aef4a8e355aa23dbd370a7a0dd2e /src/cairo-cache-private.h | |
parent | c3aac9cf49362b726a54a33a46bd8511a10f644f (diff) | |
download | cairo-45835f623f5ddda6e3258361b9d6ab27860a9198.tar.gz |
[cache] Expose init/fini methods so that caches can be embedded.
The structure is already exposed, so just expose the
constructors/destructors in order to enable caches to be embedded and
remove a superfluous malloc.
Diffstat (limited to 'src/cairo-cache-private.h')
-rw-r--r-- | src/cairo-cache-private.h | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/cairo-cache-private.h b/src/cairo-cache-private.h index 25858e544..49ff69cc0 100644 --- a/src/cairo-cache-private.h +++ b/src/cairo-cache-private.h @@ -88,6 +88,20 @@ typedef struct _cairo_cache_entry { unsigned long size; } cairo_cache_entry_t; +typedef cairo_bool_t (*cairo_cache_predicate_func_t) (const void *entry); + +struct _cairo_cache { + cairo_hash_table_t *hash_table; + + cairo_cache_predicate_func_t predicate; + cairo_destroy_func_t entry_destroy; + + unsigned long max_size; + unsigned long size; + + int freeze_count; +}; + typedef cairo_bool_t (*cairo_cache_keys_equal_func_t) (const void *key_a, const void *key_b); @@ -95,14 +109,15 @@ typedef void (*cairo_cache_callback_func_t) (void *entry, void *closure); -cairo_private cairo_cache_t * -_cairo_cache_create (cairo_cache_keys_equal_func_t keys_equal, - cairo_cache_predicate_func_t predicate, - cairo_destroy_func_t entry_destroy, - unsigned long max_size); +cairo_private cairo_status_t +_cairo_cache_init (cairo_cache_t *cache, + cairo_cache_keys_equal_func_t keys_equal, + cairo_cache_predicate_func_t predicate, + cairo_destroy_func_t entry_destroy, + unsigned long max_size); cairo_private void -_cairo_cache_destroy (cairo_cache_t *cache); +_cairo_cache_fini (cairo_cache_t *cache); cairo_private void _cairo_cache_freeze (cairo_cache_t *cache); |