PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ bytebuffer_get_buffer_varlena()

lwvarlena_t* bytebuffer_get_buffer_varlena ( const bytebuffer_t s)

Returns a copy of the internal buffer.

Definition at line 105 of file bytebuffer.c.

106 {
107  size_t bufsz = bytebuffer_getlength(s);
108  lwvarlena_t *v = lwalloc(bufsz + LWVARHDRSZ);
109  memcpy(v->data, s->buf_start, bufsz);
110  LWSIZE_SET(v->size, bufsz + LWVARHDRSZ);
111  return v;
112 }
size_t bytebuffer_getlength(const bytebuffer_t *s)
Returns the length of the current buffer.
Definition: bytebuffer.c:176
char * s
Definition: cu_in_wkt.c:23
#define LWVARHDRSZ
Definition: liblwgeom.h:311
#define LWSIZE_SET(varsize, len)
Definition: liblwgeom.h:325
void * lwalloc(size_t size)
Definition: lwutil.c:227
uint32_t size
Definition: liblwgeom.h:307
char data[]
Definition: liblwgeom.h:308

References bytebuffer_getlength(), lwvarlena_t::data, lwalloc(), LWSIZE_SET, LWVARHDRSZ, s, and lwvarlena_t::size.

Referenced by lwgeom_to_twkb_with_idlist().

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