PostGIS  2.2.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 56 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().

57 {
58  LWDEBUGF(2,"Entered bytebuffer_create_with_size %d", size);
59  bytebuffer_t *s;
61  s = lwalloc(sizeof(bytebuffer_t));
62  s->buf_start = lwalloc(size);
63  s->readcursor = s->writecursor = s->buf_start;
64  s->capacity = size;
65  memset(s->buf_start,0,size);
66  LWDEBUGF(4,"We create a buffer on %p of %d bytes", s->buf_start, size);
67  return s;
68 }
uint8_t * writecursor
Definition: bytebuffer.h:53
uint8_t * readcursor
Definition: bytebuffer.h:54
size_t capacity
Definition: bytebuffer.h:51
char * s
Definition: cu_in_wkt.c:23
uint8_t * buf_start
Definition: bytebuffer.h:52
void * lwalloc(size_t size)
Definition: lwutil.c:199
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:55
Here is the call graph for this function:
Here is the caller graph for this function: