PostGIS  3.0.6dev-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 283 of file ptarray.c.

284 {
285  POINTARRAY *pa = lwalloc(sizeof(POINTARRAY));
286  LWDEBUGF(5, "hasz = %d, hasm = %d, npoints = %d, ptlist = %p", hasz, hasm, npoints, ptlist);
287  pa->flags = lwflags(hasz, hasm, 0);
288  FLAGS_SET_READONLY(pa->flags, 1); /* We don't own this memory, so we can't alter or free it. */
289  pa->npoints = npoints;
290  pa->maxpoints = npoints;
291  pa->serialized_pointlist = ptlist;
292  return pa;
293 }
void * lwalloc(size_t size)
Definition: lwutil.c:227
#define FLAGS_SET_READONLY(flags, value)
Definition: liblwgeom.h:190
lwflags_t lwflags(int hasz, int hasm, int geodetic)
Construct a new flags bitmask.
Definition: lwutil.c:471
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
lwflags_t flags
Definition: liblwgeom.h:417
uint32_t maxpoints
Definition: liblwgeom.h:414
uint32_t npoints
Definition: liblwgeom.h:413
uint8_t * serialized_pointlist
Definition: liblwgeom.h:420

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: