[cairo-traps] Simplify the status interaction of traps_grow().

Simply return the error status from the traps_grow() function rather
than having an assignment in the return function and then immediately
another assignment of the error to the status member at its callsite.
This commit is contained in:
Chris Wilson 2007-10-09 11:08:58 +01:00
parent 66563eddd8
commit 32b78fffc3

View file

@ -257,22 +257,17 @@ _cairo_traps_grow (cairo_traps_t *traps)
cairo_trapezoid_t *new_traps;
int new_size = 2 * MAX (traps->traps_size, 16);
if (traps->status)
return traps->status;
if (traps->traps == traps->traps_embedded) {
new_traps = _cairo_malloc_ab (new_size, sizeof (cairo_trapezoid_t));
if (new_traps)
memcpy (new_traps, traps->traps, sizeof (traps->traps_embedded));
} else {
new_traps = _cairo_realloc_ab (traps->traps,
new_size, sizeof (cairo_trapezoid_t));
new_size, sizeof (cairo_trapezoid_t));
}
if (new_traps == NULL) {
traps->status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
return traps->status;
}
if (new_traps == NULL)
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
traps->traps = new_traps;
traps->traps_size = new_size;