summaryrefslogtreecommitdiff
path: root/src/cairo-xcb-connection-core.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-connection-core.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-connection-core.c')
-rw-r--r--src/cairo-xcb-connection-core.c32
1 files changed, 10 insertions, 22 deletions
diff --git a/src/cairo-xcb-connection-core.c b/src/cairo-xcb-connection-core.c
index ae7c023e1..386297d6a 100644
--- a/src/cairo-xcb-connection-core.c
+++ b/src/cairo-xcb-connection-core.c
@@ -283,32 +283,20 @@ _cairo_xcb_connection_put_subimage (cairo_xcb_connection_t *connection,
}
}
-cairo_status_t
+xcb_get_image_reply_t *
_cairo_xcb_connection_get_image (cairo_xcb_connection_t *connection,
xcb_drawable_t src,
int16_t src_x,
int16_t src_y,
uint16_t width,
- uint16_t height,
- xcb_get_image_reply_t **reply)
+ uint16_t height)
{
- xcb_generic_error_t *error;
-
- *reply = xcb_get_image_reply (connection->xcb_connection,
- xcb_get_image (connection->xcb_connection,
- XCB_IMAGE_FORMAT_Z_PIXMAP,
- src,
- src_x, src_y,
- width, height,
- (uint32_t) -1),
-
- &error);
- if (error) {
- free (error);
-
- free (*reply);
- *reply = NULL;
- }
-
- return CAIRO_STATUS_SUCCESS;
+ return xcb_get_image_reply (connection->xcb_connection,
+ xcb_get_image (connection->xcb_connection,
+ XCB_IMAGE_FORMAT_Z_PIXMAP,
+ src,
+ src_x, src_y,
+ width, height,
+ (uint32_t) -1),
+ NULL);
}