PostGIS  2.4.9dev-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 101 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().

102 {
103  size_t current_size = (s->str_end - s->str_start);
104  size_t capacity = s->capacity;
105  size_t required_size = current_size + size_to_add;
106 
107  while (capacity < required_size)
108  capacity *= 2;
109 
110  if ( capacity > s->capacity )
111  {
112  s->str_start = lwrealloc(s->str_start, capacity);
113  s->capacity = capacity;
114  s->str_end = s->str_start + current_size;
115  }
116 }
char * str_start
Definition: stringbuffer.h:41
void * lwrealloc(void *mem, size_t size)
Definition: lwutil.c:237
Here is the call graph for this function:
Here is the caller graph for this function: