PostGIS  2.5.7dev-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 accommodate the specified additional size.

Definition at line 101 of file stringbuffer.c.

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 * s
Definition: cu_in_wkt.c:23
void * lwrealloc(void *mem, size_t size)
Definition: lwutil.c:237

References lwrealloc(), and s.

Referenced by stringbuffer_append(), and stringbuffer_avprintf().

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