PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ bytebuffer_create_with_size()

bytebuffer_t* bytebuffer_create_with_size ( size_t  size)

Allocate a new bytebuffer_t.

Use bytebuffer_destroy to free.

Definition at line 44 of file bytebuffer.c.

References bytebuffer_t::buf_start, bytebuffer_t::capacity, lwalloc(), LWDEBUGF, bytebuffer_t::readcursor, s, and bytebuffer_t::writecursor.

Referenced by bytebuffer_create(), bytebuffer_merge(), and lwgeom_write_to_buffer().

45 {
46  LWDEBUGF(2,"Entered bytebuffer_create_with_size %d", size);
47  bytebuffer_t *s;
48 
49  s = lwalloc(sizeof(bytebuffer_t));
50  s->buf_start = lwalloc(size);
51  s->readcursor = s->writecursor = s->buf_start;
52  s->capacity = size;
53  memset(s->buf_start,0,size);
54  LWDEBUGF(4,"We create a buffer on %p of %d bytes", s->buf_start, size);
55  return s;
56 }
uint8_t * writecursor
Definition: bytebuffer.h:41
uint8_t * readcursor
Definition: bytebuffer.h:42
size_t capacity
Definition: bytebuffer.h:39
char * s
Definition: cu_in_wkt.c:23
uint8_t * buf_start
Definition: bytebuffer.h:40
void * lwalloc(size_t size)
Definition: lwutil.c:227
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
Here is the call graph for this function:
Here is the caller graph for this function: