summaryrefslogtreecommitdiff
path: root/src/cairo-pen.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2007-10-04 13:15:46 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2007-10-04 13:31:44 +0100
commitbed8239f03773ad1584c8ba48ceb0b34bbe69453 (patch)
treefb97a0cd4874f4fd4a2b22d6ec882a77f04202da /src/cairo-pen.c
parentd90d4bb6b99e0a912650234e28d097ea76c1cecc (diff)
downloadcairo-bed8239f03773ad1584c8ba48ceb0b34bbe69453.tar.gz
[cairo-error] Clean up all the warnings and missing _cairo_error() calls.
Every time we assign or return a hard-coded error status wrap that value with a call to _cairo_error(). So the idiom becomes: status = _cairo_error (CAIRO_STATUS_NO_MEMORY); or return _cairo_error (CAIRO_STATUS_INVALID_DASH); This ensures that a breakpoint placed on _cairo_error() will trigger immediately cairo detects the error.
Diffstat (limited to 'src/cairo-pen.c')
-rw-r--r--src/cairo-pen.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/cairo-pen.c b/src/cairo-pen.c
index 471849b01..0f0dee840 100644
--- a/src/cairo-pen.c
+++ b/src/cairo-pen.c
@@ -80,10 +80,8 @@ _cairo_pen_init (cairo_pen_t *pen,
pen->vertices = _cairo_malloc_ab (pen->num_vertices,
sizeof (cairo_pen_vertex_t));
- if (pen->vertices == NULL) {
- _cairo_error (CAIRO_STATUS_NO_MEMORY);
- return CAIRO_STATUS_NO_MEMORY;
- }
+ if (pen->vertices == NULL)
+ return _cairo_error (CAIRO_STATUS_NO_MEMORY);
/*
* Compute pen coordinates. To generate the right ellipse, compute points around
@@ -123,10 +121,9 @@ _cairo_pen_init_copy (cairo_pen_t *pen, cairo_pen_t *other)
if (pen->num_vertices) {
pen->vertices = _cairo_malloc_ab (pen->num_vertices,
sizeof (cairo_pen_vertex_t));
- if (pen->vertices == NULL) {
- _cairo_error (CAIRO_STATUS_NO_MEMORY);
- return CAIRO_STATUS_NO_MEMORY;
- }
+ if (pen->vertices == NULL)
+ return _cairo_error (CAIRO_STATUS_NO_MEMORY);
+
memcpy (pen->vertices, other->vertices, pen->num_vertices * sizeof (cairo_pen_vertex_t));
}
@@ -144,10 +141,8 @@ _cairo_pen_add_points (cairo_pen_t *pen, cairo_point_t *point, int num_points)
num_vertices = pen->num_vertices + num_points;
vertices = _cairo_realloc_ab (pen->vertices,
num_vertices, sizeof (cairo_pen_vertex_t));
- if (vertices == NULL) {
- _cairo_error (CAIRO_STATUS_NO_MEMORY);
- return CAIRO_STATUS_NO_MEMORY;
- }
+ if (vertices == NULL)
+ return _cairo_error (CAIRO_STATUS_NO_MEMORY);
pen->vertices = vertices;
pen->num_vertices = num_vertices;