PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lwcollection_reserve()

void lwcollection_reserve ( LWCOLLECTION col,
int  ngeoms 
)

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

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

Definition at line 174 of file lwcollection.c.

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

Referenced by lwcollection_add_lwgeom(), and lwgeom_node().

175 {
176  if ( ngeoms <= col->maxgeoms ) return;
177 
178  /* Allocate more space if we need it */
179  do { col->maxgeoms *= 2; } while ( col->maxgeoms < ngeoms );
180  col->geoms = lwrealloc(col->geoms, sizeof(LWGEOM*) * col->maxgeoms);
181 }
LWGEOM ** geoms
Definition: liblwgeom.h:509
void * lwrealloc(void *mem, size_t size)
Definition: lwutil.c:237
Here is the call graph for this function:
Here is the caller graph for this function: