PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ bytebuffer_init_with_size()

void bytebuffer_init_with_size ( bytebuffer_t s,
size_t  size 
)

Allocate just the internal buffer of an existing bytebuffer_t struct.

Useful for allocating short-lived bytebuffers off the stack.

Definition at line 71 of file bytebuffer.c.

72 {
73  if ( size < BYTEBUFFER_STATICSIZE )
74  {
75  s->capacity = BYTEBUFFER_STATICSIZE;
76  s->buf_start = s->buf_static;
77  }
78  else
79  {
80  s->buf_start = lwalloc(size);
81  s->capacity = size;
82  }
83  s->readcursor = s->writecursor = s->buf_start;
84  memset(s->buf_start, 0, s->capacity);
85 }
#define BYTEBUFFER_STATICSIZE
Definition: bytebuffer.h:36
char * s
Definition: cu_in_wkt.c:23
void * lwalloc(size_t size)
Definition: lwutil.c:229

References BYTEBUFFER_STATICSIZE, lwalloc(), and s.

Referenced by lwgeom_to_twkb_with_idlist(), lwgeom_write_to_buffer(), and ptarray_to_twkb_buf().

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