PostGIS  2.2.7dev-r@@SVN_REVISION@@
void lwcollection_reserve ( LWCOLLECTION col,
int  ngeoms 
)

Ensure the collection can hold up at least ngeoms.

Ensure the collection can hold at least up to ngeoms geometries.

Definition at line 161 of file lwcollection.c.

References LWCOLLECTION::geoms, lwrealloc(), and LWCOLLECTION::maxgeoms.

Referenced by lwcollection_add_lwgeom(), and lwgeom_node().

162 {
163  if ( ngeoms <= col->maxgeoms ) return;
164 
165  /* Allocate more space if we need it */
166  do { col->maxgeoms *= 2; } while ( col->maxgeoms < ngeoms );
167  col->geoms = lwrealloc(col->geoms, sizeof(LWGEOM*) * col->maxgeoms);
168 }
LWGEOM ** geoms
Definition: liblwgeom.h:493
void * lwrealloc(void *mem, size_t size)
Definition: lwutil.c:207

Here is the call graph for this function:

Here is the caller graph for this function: