third_party/cairo/src/cairo-polygon.c
static cairo_bool_t
_cairo_polygon_grow (cairo_polygon_t *polygon)
{
    cairo_edge_t *new_edges;
    int old_size = polygon->edges_size;
    int new_size = 4 * old_size;

    if (CAIRO_INJECT_FAULT ()) {
	polygon->status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
	return FALSE;
    }

    if (polygon->edges == polygon->edges_embedded) {
	new_edges = _cairo_malloc_ab (new_size, sizeof (cairo_edge_t));
	if (new_edges != NULL)
	    memcpy (new_edges, polygon->edges, old_size * sizeof (cairo_edge_t));
    } else {
	new_edges = _cairo_realloc_ab (polygon->edges,
		                       new_size, sizeof (cairo_edge_t));
    }

    if (unlikely (new_edges == NULL)) {
	polygon->status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
	return FALSE;
    }

    polygon->edges = new_edges;
    polygon->edges_size = new_size;

    return TRUE;
}
/* make room for at least one more edge */
make room for at least one more edge
make room for at least one more edge
static cairo_bool_t
_cairo_polygon_grow (cairo_polygon_t *polygon)
{
    cairo_edge_t *new_edges;
    int old_size = polygon->edges_size;
    int new_size = 4 * old_size;
    if (CAIRO_INJECT_FAULT ()) {
	polygon->status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
	return FALSE;
    }
    if (polygon->edges == polygon->edges_embedded) {
	new_edges = _cairo_malloc_ab (new_size, sizeof (cairo_edge_t));
	if (new_edges != NULL)
	    memcpy (new_edges, polygon->edges, old_size * sizeof (cairo_edge_t));
    } else {
	new_edges = _cairo_realloc_ab (polygon->edges,
		                       new_size, sizeof (cairo_edge_t));
    }
    if (unlikely (new_edges == NULL)) {
	polygon->status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
	return FALSE;
    }
    polygon->edges = new_edges;
    polygon->edges_size = new_size;
    return TRUE;
}
static cairo_bool_t _cairo_polygon_grow ( cairo_polygon_t * polygon ) { cairo_edge_t * new_edges ; int old_size = polygon -> edges_size ; int new_size = 4 * old_size ; if ( CAIRO_INJECT_FAULT ( ) ) { polygon -> status = _cairo_error ( CAIRO_STATUS_NO_MEMORY ) ; return FALSE ; } if ( polygon -> edges == polygon -> edges_embedded ) { new_edges = _cairo_malloc_ab ( new_size , sizeof ( cairo_edge_t ) ) ; if ( new_edges != NULL ) memcpy ( new_edges , polygon -> edges , old_size * sizeof ( cairo_edge_t ) ) ; } else { new_edges = _cairo_realloc_ab ( polygon -> edges , new_size , sizeof ( cairo_edge_t ) ) ; } if ( unlikely ( new_edges == NULL ) ) { polygon -> status = _cairo_error ( CAIRO_STATUS_NO_MEMORY ) ; return FALSE ; } polygon -> edges = new_edges ; polygon -> edges_size = new_size ; return TRUE ; }
make room for at least one more edge
make room for at least one more edge