PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ ptarray_construct_reference_data()

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:366
int npoints
Definition: liblwgeom.h:371
uint8_t flags
Definition: liblwgeom.h:369
uint8_t gflags(int hasz, int hasm, int geodetic)
Construct a new flags char.
Definition: g_util.c:145
int maxpoints
Definition: liblwgeom.h:372
void * lwalloc(size_t size)
Definition: lwutil.c:229
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
#define FLAGS_SET_READONLY(flags, value)
Definition: liblwgeom.h:150
Here is the call graph for this function:
Here is the caller graph for this function: