summaryrefslogtreecommitdiff
path: root/src/cairo-cache.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cairo-cache.c')
-rw-r--r--src/cairo-cache.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/cairo-cache.c b/src/cairo-cache.c
index f5caba4b..07c8b71f 100644
--- a/src/cairo-cache.c
+++ b/src/cairo-cache.c
@@ -53,7 +53,7 @@ _cairo_cache_init (cairo_cache_t *cache,
unsigned long max_size)
{
cache->hash_table = _cairo_hash_table_create (keys_equal);
- if (cache->hash_table == NULL)
+ if (unlikely (cache->hash_table == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
cache->entry_destroy = entry_destroy;
@@ -125,13 +125,13 @@ _cairo_cache_create (cairo_cache_keys_equal_func_t keys_equal,
cairo_cache_t *cache;
cache = malloc (sizeof (cairo_cache_t));
- if (cache == NULL) {
+ if (unlikely (cache == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
return NULL;
}
status = _cairo_cache_init (cache, keys_equal, entry_destroy, max_size);
- if (status) {
+ if (unlikely (status)) {
free (cache);
return NULL;
}
@@ -240,7 +240,7 @@ _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)
+ if (unlikely (entry == NULL))
return FALSE;
_cairo_cache_remove (cache, entry);
@@ -293,7 +293,7 @@ _cairo_cache_insert (cairo_cache_t *cache,
status = _cairo_hash_table_insert (cache->hash_table,
(cairo_hash_entry_t *) entry);
- if (status)
+ if (unlikely (status))
return status;
cache->size += entry->size;