diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2008-11-18 15:38:37 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2008-11-29 11:20:33 +0000 |
commit | d1801c23fae3777c7c59e084894a3410f7a1f932 (patch) | |
tree | 263906b86120ed712a9e02590871734d3bc888a8 /src/cairo-font-face.c | |
parent | f0804d4856496a46d0b2270d5815856bf63b4cf8 (diff) | |
download | cairo-d1801c23fae3777c7c59e084894a3410f7a1f932.tar.gz |
Mark if(status) as being unlikely.
The error paths should be hit very rarely during normal operation, so mark
them as being unlikely so gcc may emit better code.
Diffstat (limited to 'src/cairo-font-face.c')
-rw-r--r-- | src/cairo-font-face.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/cairo-font-face.c b/src/cairo-font-face.c index eb4921e3b..063775883 100644 --- a/src/cairo-font-face.c +++ b/src/cairo-font-face.c @@ -467,10 +467,12 @@ cairo_toy_font_face_create (const char *family, /* Make sure we've got valid UTF-8 for the family */ status = _cairo_utf8_to_ucs4 (family, -1, NULL, NULL); - if (status == CAIRO_STATUS_INVALID_STRING) - return (cairo_font_face_t*) &_cairo_font_face_invalid_string; - else if (status) + if (unlikely (status)) { + if (status == CAIRO_STATUS_INVALID_STRING) + return (cairo_font_face_t*) &_cairo_font_face_invalid_string; + return (cairo_font_face_t*) &_cairo_font_face_nil; + } switch (slant) { case CAIRO_FONT_SLANT_NORMAL: @@ -523,11 +525,11 @@ cairo_toy_font_face_create (const char *family, } status = _cairo_toy_font_face_init (font_face, family, slant, weight); - if (status) + if (unlikely (status)) goto UNWIND_FONT_FACE_MALLOC; status = _cairo_hash_table_insert (hash_table, &font_face->base.hash_entry); - if (status) + if (unlikely (status)) goto UNWIND_FONT_FACE_INIT; _cairo_toy_font_face_hash_table_unlock (); @@ -614,7 +616,7 @@ _cairo_toy_font_face_scaled_font_create (void *abstract_font_face return font_face->base.status; status = cairo_font_options_status ((cairo_font_options_t *) options); - if (status) + if (unlikely (status)) return status; if (CAIRO_SCALED_FONT_BACKEND_DEFAULT != &_cairo_user_scaled_font_backend && |