extent = PG_ARGISNULL(2) ? 4096 : PG_GETARG_INT32(2);
buffer = PG_ARGISNULL(3) ? 256 : PG_GETARG_INT32(3);
clip_geom = PG_ARGISNULL(4) ? true : PG_GETARG_BOOL(4);
+ // NOTE: can both return in clone and in place modification so
+ // not known if lwgeom_in can be freed
lwgeom_out = mvt_geom(lwgeom_in, bounds, extent, buffer, clip_geom);
- lwgeom_free(lwgeom_in);
if (lwgeom_out == NULL)
PG_RETURN_NULL();
geom_out = geometry_serialize(lwgeom_out);
+ lwgeom_free(lwgeom_out);
PG_FREE_IF_COPY(geom_in, 0);
PG_RETURN_POINTER(geom_out);
#endif
*
* Makes best effort to keep validity. Might collapse geometry into lower
* dimension.
+ *
+ * NOTE: modifies in place if possible (not currently possible for polygons)
*/
LWGEOM *mvt_geom(LWGEOM *lwgeom, const GBOX *gbox, uint32_t extent, uint32_t buffer,
bool clip_geom)