PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ stringbuffer_makeroom()

static void stringbuffer_makeroom ( stringbuffer_t s,
size_t  size_to_add 
)
inlinestatic

If necessary, expand the stringbuffer_t internal buffer to accomodate the specified additional size.

Definition at line 94 of file stringbuffer.c.

References stringbuffer_t::capacity, lwrealloc(), stringbuffer_t::str_end, and stringbuffer_t::str_start.

Referenced by stringbuffer_append(), and stringbuffer_avprintf().

95 {
96  size_t current_size = (s->str_end - s->str_start);
97  size_t capacity = s->capacity;
98  size_t required_size = current_size + size_to_add;
99 
100  while (capacity < required_size)
101  capacity *= 2;
102 
103  if ( capacity > s->capacity )
104  {
105  s->str_start = lwrealloc(s->str_start, capacity);
106  s->capacity = capacity;
107  s->str_end = s->str_start + current_size;
108  }
109 }
char * str_start
Definition: stringbuffer.h:52
void * lwrealloc(void *mem, size_t size)
Definition: lwutil.c:207
Here is the call graph for this function:
Here is the caller graph for this function: