summaryrefslogtreecommitdiff
path: root/src/cairo-clip.c
diff options
context:
space:
mode:
authorAndrea Canciani <ranma42@gmail.com>2011-03-18 16:10:39 +0100
committerAndrea Canciani <ranma42@gmail.com>2011-03-18 17:54:54 +0100
commitf2eb3f2178b6b7a75da4fb5e5bd880b769b69e62 (patch)
treea48a28a3341aea2cdecfa1580af76899b4950c61 /src/cairo-clip.c
parent7db5e3fdc8ea368547bb0b8f15d190c4f6891e20 (diff)
downloadcairo-f2eb3f2178b6b7a75da4fb5e5bd880b769b69e62.tar.gz
Improve cairo_rectangle_list_t error handling
Unify the _cairo_rectangle_list_create_in_error() functions, keeping the best features from both (the one in cairo-clip.c statically allocates the most common cases, the one in cairo.c throws a NO_MEMORY error when it cannot malloc() instead of rethrowing the same error). The same function can be used to return an error-list in _cairo_gstate_copy_clip_rectangle_list() when _cairo_clip_rectangle() fails (for example becaouse of an OOM).
Diffstat (limited to 'src/cairo-clip.c')
-rw-r--r--src/cairo-clip.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/cairo-clip.c b/src/cairo-clip.c
index 696c5b1a9..c76beee94 100644
--- a/src/cairo-clip.c
+++ b/src/cairo-clip.c
@@ -1465,8 +1465,7 @@ _cairo_clip_to_boxes (cairo_clip_t **clip,
return status;
}
-
-static cairo_rectangle_list_t *
+cairo_rectangle_list_t *
_cairo_rectangle_list_create_in_error (cairo_status_t status)
{
cairo_rectangle_list_t *list;
@@ -1478,7 +1477,7 @@ _cairo_rectangle_list_create_in_error (cairo_status_t status)
list = malloc (sizeof (*list));
if (unlikely (list == NULL)) {
- _cairo_error_throw (status);
+ status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
return (cairo_rectangle_list_t*) &_cairo_rectangles_nil;
}