Definition at line 488 of file lwgeom_geos_split.c.
References COLLECTIONTYPE, LWCOLLECTION::geoms, lwalloc(), lwcollection_construct(), lwerror(), lwfree(), lwgeom_as_lwcollection(), lwgeom_split(), lwrealloc(), LWCOLLECTION::ngeoms, LWGEOM::srid, LWCOLLECTION::srid, and SRID_UNKNOWN.
Referenced by lwgeom_split().
490 LWGEOM** split_vector=NULL;
492 size_t split_vector_capacity;
493 size_t split_vector_size=0;
496 split_vector_capacity=8;
497 split_vector =
lwalloc(split_vector_capacity *
sizeof(
LWGEOM*));
498 if ( ! split_vector )
500 lwerror(
"Out of virtual memory");
504 for (i=0; i<lwcoll_in->
ngeoms; ++i)
509 if ( ! split )
return NULL;
516 if ( split_vector_size + col->
ngeoms > split_vector_capacity )
519 split_vector_capacity += col->
ngeoms;
521 split_vector_capacity *
sizeof(
LWGEOM*));
522 if ( ! split_vector )
524 lwerror(
"Out of virtual memory");
529 for (j=0; j<col->
ngeoms; ++j)
532 split_vector[split_vector_size++] = col->
geoms[j];
540 NULL, split_vector_size, split_vector);
LWGEOM * lwgeom_split(const LWGEOM *lwgeom_in, const LWGEOM *blade_in)
LWCOLLECTION * lwcollection_construct(uint8_t type, int srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
#define SRID_UNKNOWN
Unknown SRID value.
LWCOLLECTION * lwgeom_as_lwcollection(const LWGEOM *lwgeom)
void * lwrealloc(void *mem, size_t size)
void * lwalloc(size_t size)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.