diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2008-11-18 17:26:55 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2008-11-29 11:20:34 +0000 |
commit | e6963a5bfebda69a1ef0a986cede84bcd955b6d4 (patch) | |
tree | a70bd8d15c60a71ba88bdf299244f93aa7b147d0 /src/cairo-bentley-ottmann.c | |
parent | d1801c23fae3777c7c59e084894a3410f7a1f932 (diff) | |
download | cairo-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-bentley-ottmann.c')
-rw-r--r-- | src/cairo-bentley-ottmann.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/cairo-bentley-ottmann.c b/src/cairo-bentley-ottmann.c index eca28d5ba..cd150218e 100644 --- a/src/cairo-bentley-ottmann.c +++ b/src/cairo-bentley-ottmann.c @@ -979,7 +979,7 @@ _cairo_bo_event_queue_init (cairo_bo_event_queue_t *event_queue, sizeof (cairo_bo_event_t) + sizeof (cairo_bo_event_t *), sizeof (cairo_bo_event_t *)); - if (events == NULL) + if (unlikely (events == NULL)) return _cairo_error (CAIRO_STATUS_NO_MEMORY); sorted_event_ptrs = (cairo_bo_event_t **) (events + num_events); @@ -1079,8 +1079,8 @@ _cairo_bo_sweep_line_insert (cairo_bo_sweep_line_t *sweep_line, cairo_bo_edge_t **prev_of_next, **next_of_prev; sweep_line_elt = _cairo_skip_list_insert (&sweep_line->active_edges, &edge, - 1 /* unique inserts*/); - if (sweep_line_elt == NULL) + 1 /* unique inserts*/); + if (unlikely (sweep_line_elt == NULL)) return _cairo_error (CAIRO_STATUS_NO_MEMORY); next_elt = sweep_line_elt->elt.next[0]; @@ -1659,11 +1659,10 @@ _cairo_bentley_ottmann_tessellate_polygon (cairo_traps_t *traps, has_limits = _cairo_traps_get_limit (traps, &limit); - if (polygon->num_edges < ARRAY_LENGTH (stack_edges)) { - edges = stack_edges; - } else { + edges = stack_edges; + if (polygon->num_edges > ARRAY_LENGTH (stack_edges)) { edges = _cairo_malloc_ab (polygon->num_edges, sizeof (cairo_bo_edge_t)); - if (edges == NULL) + if (unlikely (edges == NULL)) return _cairo_error (CAIRO_STATUS_NO_MEMORY); } |