summaryrefslogtreecommitdiff
path: root/src/cairo-xcb-surface.c
diff options
context:
space:
mode:
authorUli Schlachter <psychon@znc.in>2013-09-16 12:45:21 +0200
committerUli Schlachter <psychon@znc.in>2013-09-16 12:59:03 +0200
commit9c75065ecefe18557c9d56e1c973215f01f3cd40 (patch)
tree69e5f0b0460942a02f66dfa591c80d3fceffb9d6 /src/cairo-xcb-surface.c
parent440624cdf2bd55ac1620e697cc481a8fbbb1c657 (diff)
downloadcairo-9c75065ecefe18557c9d56e1c973215f01f3cd40.tar.gz
xcb: Remove useless error handling
All the *_reply() functions in XCB return a pointer to their result and as last argument they get a xcb_generic_error_t** where pointers to errors are stored, if any occurs. However, a request can either fail or succeed. This means that if the returned result is a NULL pointer, then an error occurred and the other way around: If the error pointer is set to non-NULL, then the function must have returned NULL. Thus, all the code, which just checks if an error occurred and which does not care about the exact error code, does not need to get the error pointer at all. In this case, xcb will free() the error internally. While doing this, I noticed that _cairo_xcb_connection_get_image() always succeeds and thus its return value can be replaced with the GetImage result. Signed-off-by: Uli Schlachter <psychon@znc.in>
Diffstat (limited to 'src/cairo-xcb-surface.c')
-rw-r--r--src/cairo-xcb-surface.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c
index 746fb4534..c900edce6 100644
--- a/src/cairo-xcb-surface.c
+++ b/src/cairo-xcb-surface.c
@@ -382,13 +382,10 @@ _get_image (cairo_xcb_surface_t *surface,
}
}
- status = _cairo_xcb_connection_get_image (connection,
- surface->drawable,
- x, y,
- width, height,
- &reply);
- if (unlikely (status))
- goto FAIL;
+ reply =_cairo_xcb_connection_get_image (connection,
+ surface->drawable,
+ x, y,
+ width, height);
if (reply == NULL && ! surface->owns_pixmap) {
/* xcb_get_image_t from a window is dangerous because it can
@@ -422,15 +419,11 @@ _get_image (cairo_xcb_surface_t *surface,
_cairo_xcb_screen_put_gc (surface->screen, surface->depth, gc);
- status = _cairo_xcb_connection_get_image (connection,
- pixmap,
- 0, 0,
- width, height,
- &reply);
+ reply = _cairo_xcb_connection_get_image (connection,
+ pixmap,
+ 0, 0,
+ width, height);
_cairo_xcb_connection_free_pixmap (connection, pixmap);
-
- if (unlikely (status))
- goto FAIL;
}
if (unlikely (reply == NULL)) {