PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ ptarray_construct_reference_data()

POINTARRAY* ptarray_construct_reference_data ( char  hasz,
char  hasm,
uint32_t  npoints,
uint8_t *  ptlist 
)

Construct a new POINTARRAY, referencing to the data from ptlist.

Construct a new POINTARRAY, referencing to the data from ptlist.

Flag as read-only, so that ptarray_free() does not free the serialized_ptlist

Definition at line 291 of file ptarray.c.

292 {
293  POINTARRAY *pa = lwalloc(sizeof(POINTARRAY));
294  LWDEBUGF(5, "hasz = %d, hasm = %d, npoints = %d, ptlist = %p", hasz, hasm, npoints, ptlist);
295  pa->flags = lwflags(hasz, hasm, 0);
296  FLAGS_SET_READONLY(pa->flags, 1); /* We don't own this memory, so we can't alter or free it. */
297  pa->npoints = npoints;
298  pa->maxpoints = npoints;
299  pa->serialized_pointlist = ptlist;
300  return pa;
301 }
void * lwalloc(size_t size)
Definition: lwutil.c:227
#define FLAGS_SET_READONLY(flags, value)
Definition: liblwgeom.h:176
lwflags_t lwflags(int hasz, int hasm, int geodetic)
Construct a new flags bitmask.
Definition: lwutil.c:477
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:106
lwflags_t flags
Definition: liblwgeom.h:431
uint32_t maxpoints
Definition: liblwgeom.h:428
uint32_t npoints
Definition: liblwgeom.h:427
uint8_t * serialized_pointlist
Definition: liblwgeom.h:434

References POINTARRAY::flags, FLAGS_SET_READONLY, lwalloc(), LWDEBUGF, lwflags(), POINTARRAY::maxpoints, POINTARRAY::npoints, and POINTARRAY::serialized_pointlist.

Referenced by lwcircstring_from_gserialized1_buffer(), lwcircstring_from_gserialized2_buffer(), lwcircstring_from_lwmpoint(), lwcircstring_from_lwpointarray(), lwline_from_gserialized1_buffer(), lwline_from_gserialized2_buffer(), lwpoint_from_gserialized1_buffer(), lwpoint_from_gserialized2_buffer(), lwpoly_from_gserialized1_buffer(), lwpoly_from_gserialized2_buffer(), lwtriangle_from_gserialized1_buffer(), lwtriangle_from_gserialized2_buffer(), and test_gbox_from_spherical_coordinates().

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