PostGIS  2.3.7dev-r@@SVN_REVISION@@
POINTARRAY* ptarray_construct_reference_data ( char  hasz,
char  hasm,
uint32_t  npoints,
uint8_t *  ptlist 
)

Build a new POINTARRAY, but on top of someone else's ordinate array.

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 295 of file ptarray.c.

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().

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

Here is the call graph for this function:

Here is the caller graph for this function: