summaryrefslogtreecommitdiff
path: root/src/cairo-pen.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2008-11-18 17:26:55 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2008-11-29 11:20:34 +0000
commite6963a5bfebda69a1ef0a986cede84bcd955b6d4 (patch)
treea70bd8d15c60a71ba88bdf299244f93aa7b147d0 /src/cairo-pen.c
parentd1801c23fae3777c7c59e084894a3410f7a1f932 (diff)
downloadcairo-e6963a5bfebda69a1ef0a986cede84bcd955b6d4.tar.gz
Mark allocation failures as unlikely.
Use the gcc likelihood annotation to indicate that allocation failures are extremely unlikely.
Diffstat (limited to 'src/cairo-pen.c')
-rw-r--r--src/cairo-pen.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/cairo-pen.c b/src/cairo-pen.c
index 21ed8e358..4158f1751 100644
--- a/src/cairo-pen.c
+++ b/src/cairo-pen.c
@@ -65,7 +65,7 @@ _cairo_pen_init (cairo_pen_t *pen,
if (pen->num_vertices > ARRAY_LENGTH (pen->vertices_embedded)) {
pen->vertices = _cairo_malloc_ab (pen->num_vertices,
sizeof (cairo_pen_vertex_t));
- if (pen->vertices == NULL)
+ if (unlikely (pen->vertices == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
} else {
pen->vertices = pen->vertices_embedded;
@@ -112,7 +112,7 @@ _cairo_pen_init_copy (cairo_pen_t *pen, const cairo_pen_t *other)
if (pen->num_vertices > ARRAY_LENGTH (pen->vertices_embedded)) {
pen->vertices = _cairo_malloc_ab (pen->num_vertices,
sizeof (cairo_pen_vertex_t));
- if (pen->vertices == NULL)
+ if (unlikely (pen->vertices == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}
@@ -139,7 +139,7 @@ _cairo_pen_add_points (cairo_pen_t *pen, cairo_point_t *point, int num_points)
if (pen->vertices == pen->vertices_embedded) {
vertices = _cairo_malloc_ab (num_vertices,
sizeof (cairo_pen_vertex_t));
- if (vertices == NULL)
+ if (unlikely (vertices == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
memcpy (vertices, pen->vertices,
@@ -148,7 +148,7 @@ _cairo_pen_add_points (cairo_pen_t *pen, cairo_point_t *point, int num_points)
vertices = _cairo_realloc_ab (pen->vertices,
num_vertices,
sizeof (cairo_pen_vertex_t));
- if (vertices == NULL)
+ if (unlikely (vertices == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}