diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2008-11-18 17:26:55 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2008-11-29 11:20:34 +0000 |
commit | e6963a5bfebda69a1ef0a986cede84bcd955b6d4 (patch) | |
tree | a70bd8d15c60a71ba88bdf299244f93aa7b147d0 /src/cairo-cache.c | |
parent | d1801c23fae3777c7c59e084894a3410f7a1f932 (diff) |
Mark allocation failures as unlikely.
Use the gcc likelihood annotation to indicate that allocation failures are
extremely unlikely.
Diffstat (limited to 'src/cairo-cache.c')
-rw-r--r-- | src/cairo-cache.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/cairo-cache.c b/src/cairo-cache.c index 73172642..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,7 +125,7 @@ _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; } @@ -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); |