summaryrefslogtreecommitdiff
path: root/src/cairo-font-face.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2008-11-07 20:30:33 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2008-11-07 20:50:34 +0000
commit2b32c8b9e572c96ce8ba5c7d43b568f18f6da295 (patch)
tree5bbac3fa688087fb74d3598105dd50786c68816c /src/cairo-font-face.c
parentd15fb9344bf86dd52cda0b43d3dfc49397fd84ec (diff)
downloadcairo-2b32c8b9e572c96ce8ba5c7d43b568f18f6da295.tar.gz
[hash] Return lookup entry.
Use the return value to return the result from _cairo_hash_table_lookup() (as opposed to filling an output parameter on the stack) as this (a) results in cleaner code (no strict-alias breaking pointer casts), (b) produces a smaller binary and (c) is measurably faster.
Diffstat (limited to 'src/cairo-font-face.c')
-rw-r--r--src/cairo-font-face.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/cairo-font-face.c b/src/cairo-font-face.c
index 6cea39585..f9a838ae6 100644
--- a/src/cairo-font-face.c
+++ b/src/cairo-font-face.c
@@ -499,11 +499,10 @@ cairo_toy_font_face_create (const char *family,
_cairo_toy_font_face_init_key (&key, family, slant, weight);
/* Return existing font_face if it exists in the hash table. */
- if (_cairo_hash_table_lookup (hash_table,
- &key.base.hash_entry,
- (cairo_hash_entry_t **) &font_face))
- {
- if (! font_face->base.status) {
+ font_face = _cairo_hash_table_lookup (hash_table,
+ &key.base.hash_entry);
+ if (font_face != NULL) {
+ if (font_face->base.status == CAIRO_STATUS_SUCCESS) {
/* We increment the reference count here manually to avoid
double-locking. */
_cairo_reference_count_inc (&font_face->base.ref_count);