PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ lwcollection_reserve()

void lwcollection_reserve ( LWCOLLECTION col,
uint32_t  ngeoms 
)

Ensure the collection can hold up at least ngeoms.

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

Definition at line 176 of file lwcollection.c.

177 {
178  if ( ngeoms <= col->maxgeoms ) return;
179 
180  /* Allocate more space if we need it */
181  do { col->maxgeoms *= 2; } while ( col->maxgeoms < ngeoms );
182  col->geoms = lwrealloc(col->geoms, sizeof(LWGEOM*) * col->maxgeoms);
183 }
void * lwrealloc(void *mem, size_t size)
Definition: lwutil.c:242
uint32_t maxgeoms
Definition: liblwgeom.h:581
LWGEOM ** geoms
Definition: liblwgeom.h:575

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

Referenced by lwcollection_add_lwgeom(), and lwgeom_node().

Here is the call graph for this function:
Here is the caller graph for this function: