PostGIS  2.5.7dev-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.

45 {
46  LWDEBUGF(2,"Entered bytebuffer_create_with_size %d", size);
47  bytebuffer_t *s;
48 
49  s = lwalloc(sizeof(bytebuffer_t));
50  if ( size < BYTEBUFFER_STATICSIZE )
51  {
52  s->capacity = BYTEBUFFER_STATICSIZE;
53  s->buf_start = s->buf_static;
54  }
55  else
56  {
57  s->buf_start = lwalloc(size);
58  s->capacity = size;
59  }
60  s->readcursor = s->writecursor = s->buf_start;
61  memset(s->buf_start,0,s->capacity);
62  LWDEBUGF(4,"We create a buffer on %p of %d bytes", s->buf_start, s->capacity);
63  return s;
64 }
#define BYTEBUFFER_STATICSIZE
Definition: bytebuffer.h:36
char * s
Definition: cu_in_wkt.c:23
void * lwalloc(size_t size)
Definition: lwutil.c:229
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88

References BYTEBUFFER_STATICSIZE, lwalloc(), LWDEBUGF, and s.

Referenced by bytebuffer_create(), and bytebuffer_merge().

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