PostGIS  2.5.7dev-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 293 of file ptarray.c.

294 {
295  POINTARRAY *pa = lwalloc(sizeof(POINTARRAY));
296  LWDEBUGF(5, "hasz = %d, hasm = %d, npoints = %d, ptlist = %p", hasz, hasm, npoints, ptlist);
297  pa->flags = gflags(hasz, hasm, 0);
298  FLAGS_SET_READONLY(pa->flags, 1); /* We don't own this memory, so we can't alter or free it. */
299  pa->npoints = npoints;
300  pa->maxpoints = npoints;
301  pa->serialized_pointlist = ptlist;
302  return pa;
303 }
uint8_t gflags(int hasz, int hasm, int geodetic)
Construct a new flags char.
Definition: g_util.c:145
void * lwalloc(size_t size)
Definition: lwutil.c:229
#define FLAGS_SET_READONLY(flags, value)
Definition: liblwgeom.h:150
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
uint32_t maxpoints
Definition: liblwgeom.h:375
uint32_t npoints
Definition: liblwgeom.h:374
uint8_t * serialized_pointlist
Definition: liblwgeom.h:369
uint8_t flags
Definition: liblwgeom.h:372

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

Referenced by lwcircstring_from_gserialized_buffer(), lwcircstring_from_lwmpoint(), lwcircstring_from_lwpointarray(), lwline_from_gserialized_buffer(), lwpoint_from_gserialized_buffer(), lwpoly_from_gserialized_buffer(), lwtriangle_from_gserialized_buffer(), and test_gbox_from_spherical_coordinates().

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