PostGIS  2.1.10dev-r@@SVN_REVISION@@
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 95 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().

96 {
97  size_t current_size = (s->str_end - s->str_start);
98  size_t capacity = s->capacity;
99  size_t required_size = current_size + size_to_add;
100 
101  while (capacity < required_size)
102  capacity *= 2;
103 
104  if ( capacity > s->capacity )
105  {
106  s->str_start = lwrealloc(s->str_start, capacity);
107  s->capacity = capacity;
108  s->str_end = s->str_start + current_size;
109  }
110 }
char * str_start
Definition: stringbuffer.h:53
void * lwrealloc(void *mem, size_t size)
Definition: lwutil.c:183

Here is the call graph for this function:

Here is the caller graph for this function: