diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2008-08-17 11:35:58 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2008-08-17 11:39:56 +0100 |
commit | 3998040c1151ffbc3f8748ca430af5bd81ca92e4 (patch) | |
tree | acffdf3a7fd960ebc2470bc3763e95d106250a6e /src/cairo-cache.c | |
parent | 841fe91c0e0ef0b88f84e8130b8e2afaa8abb610 (diff) | |
download | cairo-3998040c1151ffbc3f8748ca430af5bd81ca92e4.tar.gz |
[cairo-cache] Simplify a status return to boolean.
_cairo_cache_remove_random() just returned whether it found an entry to
remove and so the code can be simplified by returning a boolean as opposed
to a status code.
Diffstat (limited to 'src/cairo-cache.c')
-rw-r--r-- | src/cairo-cache.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/src/cairo-cache.c b/src/cairo-cache.c index bb5c719ff..16acbda4a 100644 --- a/src/cairo-cache.c +++ b/src/cairo-cache.c @@ -239,22 +239,21 @@ _cairo_cache_lookup (cairo_cache_t *cache, * * Remove a random entry from the cache. * - * Return value: %CAIRO_STATUS_SUCCESS if an entry was successfully - * removed. %CAIRO_INT_STATUS_CACHE_EMPTY if there are no entries that - * can be removed. + * Return value: TRUE if an entry was successfully removed. + * FALSE if there are no entries that can be removed. **/ -static cairo_int_status_t +static cairo_bool_t _cairo_cache_remove_random (cairo_cache_t *cache) { cairo_cache_entry_t *entry; entry = _cairo_hash_table_random_entry (cache->hash_table, NULL); if (entry == NULL) - return CAIRO_INT_STATUS_CACHE_EMPTY; + return FALSE; _cairo_cache_remove (cache, entry); - return CAIRO_STATUS_SUCCESS; + return TRUE; } /** @@ -269,20 +268,14 @@ _cairo_cache_remove_random (cairo_cache_t *cache) **/ static void _cairo_cache_shrink_to_accommodate (cairo_cache_t *cache, - unsigned long additional) + unsigned long additional) { - cairo_int_status_t status; - if (cache->freeze_count) return; while (cache->size + additional > cache->max_size) { - status = _cairo_cache_remove_random (cache); - if (status) { - if (status == CAIRO_INT_STATUS_CACHE_EMPTY) - return; - ASSERT_NOT_REACHED; - } + if (! _cairo_cache_remove_random (cache)) + return; } } |