[cairo-commit] src/cairo-xlib-surface.c

Carl Worth cworth at kemper.freedesktop.org
Thu Jun 22 22:43:22 PDT 2006


 src/cairo-xlib-surface.c |   28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)

New commits:
diff-tree 5488c3b462260126a000928aa599684d7b1041e7 (from 7e457cb4c1e69670f27e3e8e134a9e32a8f75788)
Author: Carl Worth <cworth at cworth.org>
Date:   Thu Jun 22 22:38:17 2006 -0700

    xlib: Prefer BAIL over FAIL when the cleanup code is also used in succesful cases.

diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index 8eb5580..32e2bd9 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -1297,12 +1297,12 @@ _cairo_xlib_surface_composite (cairo_ope
 						   mask_pattern != NULL);
     if (operation == DO_UNSUPPORTED) {
 	status = CAIRO_INT_STATUS_UNSUPPORTED;
-	goto FAIL;
+	goto BAIL;
     }
 
     status = _cairo_xlib_surface_set_attributes (src, &src_attr);
     if (status)
-	goto FAIL;
+	goto BAIL;
 
     switch (operation)
     {
@@ -1311,7 +1311,7 @@ _cairo_xlib_surface_composite (cairo_ope
 	if (mask) {
 	    status = _cairo_xlib_surface_set_attributes (mask, &mask_attr);
 	    if (status)
-		goto FAIL;
+		goto BAIL;
 
 	    XRenderComposite (dst->dpy,
 			      _render_operator (op),
@@ -1386,8 +1386,7 @@ _cairo_xlib_surface_composite (cairo_ope
 							 mask_x, mask_y,
 							 dst_x, dst_y, width, height);
 
- FAIL:
-
+ BAIL:
     if (mask)
 	_cairo_pattern_release_surface (mask_pattern, &mask->base, &mask_attr);
 
@@ -1555,7 +1554,7 @@ _cairo_xlib_surface_composite_trapezoids
     operation = _recategorize_composite_operation (dst, op, src, &attributes, TRUE);
     if (operation == DO_UNSUPPORTED) {
 	status = CAIRO_INT_STATUS_UNSUPPORTED;
-	goto FAIL;
+	goto BAIL;
     }
 
     switch (antialias) {
@@ -1581,7 +1580,7 @@ _cairo_xlib_surface_composite_trapezoids
     _cairo_xlib_surface_ensure_dst_picture (dst);
     status = _cairo_xlib_surface_set_attributes (src, &attributes);
     if (status)
-	goto FAIL;
+	goto BAIL;
 
     if (!_cairo_operator_bounded_by_mask (op)) {
 	/* XRenderCompositeTrapezoids() creates a mask only large enough for the
@@ -1598,7 +1597,7 @@ _cairo_xlib_surface_composite_trapezoids
 						       pict_format);
 	if (!mask_picture) {
 	    status = CAIRO_STATUS_NO_MEMORY;
-	    goto FAIL;
+	    goto BAIL;
 	}
 
 	XRenderComposite (dst->dpy,
@@ -1632,7 +1631,7 @@ _cairo_xlib_surface_composite_trapezoids
 				    (XTrapezoid *) traps, num_traps);
     }
 
- FAIL:
+ BAIL:
     _cairo_pattern_release_surface (pattern, &src->base, &attributes);
 
     return status;
@@ -2680,17 +2679,17 @@ _cairo_xlib_surface_show_glyphs (void   
     }
 
     if (status)
-        goto FAIL;
+        goto BAIL;
 
     operation = _recategorize_composite_operation (dst, op, src, &attributes, TRUE);
     if (operation == DO_UNSUPPORTED) {
 	status = CAIRO_INT_STATUS_UNSUPPORTED;
-	goto FAIL;
+	goto BAIL;
     }
 
     status = _cairo_xlib_surface_set_attributes (src, &attributes);
     if (status)
-        goto FAIL;
+        goto BAIL;
 
     /* Send all unsent glyphs to the server, and count the max of the glyph indices */
     for (i = 0; i < num_glyphs; i++) {
@@ -2701,7 +2700,7 @@ _cairo_xlib_surface_show_glyphs (void   
 					     CAIRO_SCALED_GLYPH_INFO_SURFACE,
 					     &scaled_glyph);
 	if (status != CAIRO_STATUS_SUCCESS)
-	    goto FAIL;
+	    goto BAIL;
 	if (scaled_glyph->surface_private == NULL) {
 	    _cairo_xlib_surface_add_glyph (dst->dpy, scaled_font, scaled_glyph);
 	    scaled_glyph->surface_private = (void *) 1;
@@ -2736,12 +2735,13 @@ _cairo_xlib_surface_show_glyphs (void   
 	    break;
     }
 
-  FAIL:
+  BAIL:
     _cairo_scaled_font_thaw_cache (scaled_font);
 
     if (src)
         _cairo_pattern_release_surface (src_pattern, &src->base, &attributes);
     if (src_pattern == &solid_pattern.base)
 	_cairo_pattern_fini (&solid_pattern.base);
+
     return status;
 }


More information about the cairo-commit mailing list