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-pdf-operators.c | |
parent | f0804d4856496a46d0b2270d5815856bf63b4cf8 (diff) |
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-pdf-operators.c')
-rw-r--r-- | src/cairo-pdf-operators.c | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/src/cairo-pdf-operators.c b/src/cairo-pdf-operators.c index d363805f..9d5bcba1 100644 --- a/src/cairo-pdf-operators.c +++ b/src/cairo-pdf-operators.c @@ -447,7 +447,7 @@ _cairo_pdf_operators_emit_path (cairo_pdf_operators_t *pdf_operators, word_wrap = _word_wrap_stream_create (pdf_operators->stream, 72); status = _cairo_output_stream_get_status (word_wrap); - if (status) + if (unlikely (status)) return _cairo_output_stream_destroy (word_wrap); info.output = word_wrap; @@ -488,7 +488,7 @@ _cairo_pdf_operators_clip (cairo_pdf_operators_t *pdf_operators, path, &pdf_operators->cairo_to_pdf, CAIRO_LINE_CAP_ROUND); - if (status) + if (unlikely (status)) return status; } @@ -714,7 +714,7 @@ _cairo_pdf_operators_emit_stroke (cairo_pdf_operators_t *pdf_operators, if (pdf_operators->in_text_object) { status = _cairo_pdf_operators_end_text (pdf_operators); - if (status) + if (unlikely (status)) return status; } @@ -753,7 +753,7 @@ _cairo_pdf_operators_emit_stroke (cairo_pdf_operators_t *pdf_operators, _cairo_matrix_factor_out_scale (&m, &scale); path_transform = m; status = cairo_matrix_invert (&path_transform); - if (status) + if (unlikely (status)) return status; cairo_matrix_multiply (&m, &m, &pdf_operators->cairo_to_pdf); @@ -762,7 +762,7 @@ _cairo_pdf_operators_emit_stroke (cairo_pdf_operators_t *pdf_operators, status = _cairo_pdf_operators_emit_stroke_style (pdf_operators, style, scale); if (status == CAIRO_INT_STATUS_NOTHING_TO_DO) return CAIRO_STATUS_SUCCESS; - if (status) + if (unlikely (status)) return status; if (has_ctm) { @@ -778,7 +778,7 @@ _cairo_pdf_operators_emit_stroke (cairo_pdf_operators_t *pdf_operators, path, &path_transform, style->line_cap); - if (status) + if (unlikely (status)) return status; _cairo_output_stream_printf (pdf_operators->stream, "%s", pdf_operator); @@ -815,7 +815,7 @@ _cairo_pdf_operators_fill (cairo_pdf_operators_t *pdf_operators, if (pdf_operators->in_text_object) { status = _cairo_pdf_operators_end_text (pdf_operators); - if (status) + if (unlikely (status)) return status; } @@ -823,7 +823,7 @@ _cairo_pdf_operators_fill (cairo_pdf_operators_t *pdf_operators, path, &pdf_operators->cairo_to_pdf, CAIRO_LINE_CAP_ROUND); - if (status) + if (unlikely (status)) return status; switch (fill_rule) { @@ -964,7 +964,7 @@ _cairo_pdf_operators_flush_glyphs (cairo_pdf_operators_t *pdf_operators) word_wrap_stream = _word_wrap_stream_create (pdf_operators->stream, 72); status = _cairo_output_stream_get_status (word_wrap_stream); - if (status) + if (unlikely (status)) return _cairo_output_stream_destroy (word_wrap_stream); /* Check if glyph advance used to position every glyph */ @@ -1023,7 +1023,7 @@ _cairo_pdf_operators_set_text_matrix (cairo_pdf_operators_t *pdf_operators, /* We require the matrix to be invertable. */ inverse = *matrix; status = cairo_matrix_invert (&inverse); - if (status) + if (unlikely (status)) return status; pdf_operators->text_matrix = *matrix; @@ -1112,7 +1112,7 @@ _cairo_pdf_operators_set_font_subset (cairo_pdf_operators_t *pdf_ope status = pdf_operators->use_font_subset (subset_glyph->font_id, subset_glyph->subset_id, pdf_operators->use_font_subset_closure); - if (status) + if (unlikely (status)) return status; } pdf_operators->font_id = subset_glyph->font_id; @@ -1143,7 +1143,7 @@ _cairo_pdf_operators_end_text (cairo_pdf_operators_t *pdf_operators) cairo_status_t status; status = _cairo_pdf_operators_flush_glyphs (pdf_operators); - if (status) + if (unlikely (status)) return status; _cairo_output_stream_printf (pdf_operators->stream, "ET\n"); @@ -1177,7 +1177,7 @@ _cairo_pdf_operators_begin_actualtext (cairo_pdf_operators_t *pdf_operators, _cairo_output_stream_printf (pdf_operators->stream, "/Span << /ActualText <feff"); if (utf8_len) { status = _cairo_utf8_to_utf16 (utf8, utf8_len, &utf16, &utf16_len); - if (status) + if (unlikely (status)) return status; for (i = 0; i < utf16_len; i++) { @@ -1212,11 +1212,11 @@ _cairo_pdf_operators_emit_glyph (cairo_pdf_operators_t *pdf_operator pdf_operators->subset_id != subset_glyph->subset_id) { status = _cairo_pdf_operators_flush_glyphs (pdf_operators); - if (status) + if (unlikely (status)) return status; status = _cairo_pdf_operators_set_font_subset (pdf_operators, subset_glyph); - if (status) + if (unlikely (status)) return status; pdf_operators->is_new_text_object = FALSE; @@ -1241,14 +1241,14 @@ _cairo_pdf_operators_emit_glyph (cairo_pdf_operators_t *pdf_operator fabs(y - pdf_operators->cur_y) > GLYPH_POSITION_TOLERANCE) { status = _cairo_pdf_operators_flush_glyphs (pdf_operators); - if (status) + if (unlikely (status)) return status; x = glyph->x; y = glyph->y; cairo_matrix_transform_point (&pdf_operators->cairo_to_pdf, &x, &y); status = _cairo_pdf_operators_set_text_position (pdf_operators, x, y); - if (status) + if (unlikely (status)) return status; x = 0.0; @@ -1296,14 +1296,14 @@ _cairo_pdf_operators_emit_cluster (cairo_pdf_operators_t *pdf_operators, utf8, utf8_len, &subset_glyph); - if (status) + if (unlikely (status)) return status; if (subset_glyph.utf8_is_mapped || utf8_len < 0) { status = _cairo_pdf_operators_emit_glyph (pdf_operators, glyphs, &subset_glyph); - if (status) + if (unlikely (status)) return status; return CAIRO_STATUS_SUCCESS; @@ -1313,11 +1313,11 @@ _cairo_pdf_operators_emit_cluster (cairo_pdf_operators_t *pdf_operators, /* Fallback to using ActualText to map zero or more glyphs to a * unicode string. */ status = _cairo_pdf_operators_flush_glyphs (pdf_operators); - if (status) + if (unlikely (status)) return status; status = _cairo_pdf_operators_begin_actualtext (pdf_operators, utf8, utf8_len); - if (status) + if (unlikely (status)) return status; cur_glyph = glyphs; @@ -1329,13 +1329,13 @@ _cairo_pdf_operators_emit_cluster (cairo_pdf_operators_t *pdf_operators, cur_glyph->index, NULL, -1, &subset_glyph); - if (status) + if (unlikely (status)) return status; status = _cairo_pdf_operators_emit_glyph (pdf_operators, cur_glyph, &subset_glyph); - if (status) + if (unlikely (status)) return status; if ((cluster_flags & CAIRO_TEXT_CLUSTER_FLAG_BACKWARD)) @@ -1344,7 +1344,7 @@ _cairo_pdf_operators_emit_cluster (cairo_pdf_operators_t *pdf_operators, cur_glyph++; } status = _cairo_pdf_operators_flush_glyphs (pdf_operators); - if (status) + if (unlikely (status)) return status; status = _cairo_pdf_operators_end_actualtext (pdf_operators); @@ -1374,13 +1374,13 @@ _cairo_pdf_operators_show_text_glyphs (cairo_pdf_operators_t *pdf_operators, status = cairo_matrix_invert (&pdf_operators->font_matrix_inverse); if (status == CAIRO_STATUS_INVALID_MATRIX) return CAIRO_STATUS_SUCCESS; - if (status) + if (unlikely (status)) return status; pdf_operators->is_new_text_object = FALSE; if (pdf_operators->in_text_object == FALSE) { status = _cairo_pdf_operators_begin_text (pdf_operators); - if (status) + if (unlikely (status)) return status; /* Force Tm and Tf to be emitted when starting a new text @@ -1401,7 +1401,7 @@ _cairo_pdf_operators_show_text_glyphs (cairo_pdf_operators_t *pdf_operators, ! _cairo_matrix_scale_equal (&pdf_operators->text_matrix, &text_matrix)) { status = _cairo_pdf_operators_flush_glyphs (pdf_operators); - if (status) + if (unlikely (status)) return status; x = glyphs[0].x; @@ -1412,7 +1412,7 @@ _cairo_pdf_operators_show_text_glyphs (cairo_pdf_operators_t *pdf_operators, status = _cairo_pdf_operators_set_text_matrix (pdf_operators, &text_matrix); if (status == CAIRO_STATUS_INVALID_MATRIX) return CAIRO_STATUS_SUCCESS; - if (status) + if (unlikely (status)) return status; } @@ -1432,7 +1432,7 @@ _cairo_pdf_operators_show_text_glyphs (cairo_pdf_operators_t *pdf_operators, clusters[i].num_glyphs, cluster_flags, scaled_font); - if (status) + if (unlikely (status)) return status; cur_text += clusters[i].num_bytes; @@ -1448,7 +1448,7 @@ _cairo_pdf_operators_show_text_glyphs (cairo_pdf_operators_t *pdf_operators, 1, FALSE, scaled_font); - if (status) + if (unlikely (status)) return status; } } |