mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2025-12-25 00:10:10 +01:00
[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:
parent
66563eddd8
commit
32b78fffc3
1 changed files with 3 additions and 8 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue