mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-03 19:28:01 +02:00
core: dropped actually unused parameter of _cairo_boxes_to_array()
When parameter force_allocation is false *and* the box set has exactly one chunk, this chunk is returned directly - w/o copying it. That mode is never used, and it's highly problematic as it's unclear whether we have to free the returnd object or it's still owned by somebody else. Just dropping the useless parameter / corner case to make the function simpler and more robust. Signed-off-by: Enrico Weigelt, metux IT consult <enrico.weigelt@gr13.net> Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
b23c2291d8
commit
5bb43c92b3
3 changed files with 4 additions and 8 deletions
|
|
@ -92,8 +92,7 @@ _cairo_boxes_extents (const cairo_boxes_t *boxes,
|
|||
|
||||
cairo_private cairo_box_t *
|
||||
_cairo_boxes_to_array (const cairo_boxes_t *boxes,
|
||||
int *num_boxes,
|
||||
cairo_bool_t force_allocation);
|
||||
int *num_boxes);
|
||||
|
||||
cairo_private cairo_status_t
|
||||
_cairo_boxes_intersect (const cairo_boxes_t *a,
|
||||
|
|
|
|||
|
|
@ -345,16 +345,13 @@ _cairo_boxes_clear (cairo_boxes_t *boxes)
|
|||
* */
|
||||
cairo_box_t *
|
||||
_cairo_boxes_to_array (const cairo_boxes_t *boxes,
|
||||
int *num_boxes,
|
||||
cairo_bool_t force_allocation)
|
||||
int *num_boxes)
|
||||
{
|
||||
const struct _cairo_boxes_chunk *chunk;
|
||||
cairo_box_t *box;
|
||||
int i, j;
|
||||
|
||||
*num_boxes = boxes->num_boxes;
|
||||
if (boxes->chunks.next == NULL && ! force_allocation)
|
||||
return boxes->chunks.base;
|
||||
|
||||
box = _cairo_malloc_ab (boxes->num_boxes, sizeof (cairo_box_t));
|
||||
if (box == NULL) {
|
||||
|
|
|
|||
|
|
@ -306,7 +306,7 @@ _cairo_clip_intersect_boxes (cairo_clip_t *clip,
|
|||
clip->boxes[0] = boxes->chunks.base[0];
|
||||
clip->num_boxes = 1;
|
||||
} else {
|
||||
clip->boxes = _cairo_boxes_to_array (boxes, &clip->num_boxes, TRUE);
|
||||
clip->boxes = _cairo_boxes_to_array (boxes, &clip->num_boxes);
|
||||
}
|
||||
_cairo_boxes_extents (boxes, &limits);
|
||||
|
||||
|
|
@ -580,7 +580,7 @@ _cairo_clip_from_boxes (const cairo_boxes_t *boxes)
|
|||
clip->boxes[0] = boxes->chunks.base[0];
|
||||
clip->num_boxes = 1;
|
||||
} else {
|
||||
clip->boxes = _cairo_boxes_to_array (boxes, &clip->num_boxes, TRUE);
|
||||
clip->boxes = _cairo_boxes_to_array (boxes, &clip->num_boxes);
|
||||
if (clip->boxes == NULL)
|
||||
return _cairo_clip_set_all_clipped (clip);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue