PostGIS  3.4.0dev-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 71 of file stringbuffer.h.

72 {
73  size_t current_size = (s->str_end - s->str_start);
74  size_t capacity = s->capacity;
75  size_t required_size = current_size + size_to_add;
76 
77  while (capacity < required_size)
78  capacity *= 2;
79 
80  if (capacity > s->capacity)
81  {
82  s->str_start = lwrealloc(s->str_start, capacity);
83  s->capacity = capacity;
84  s->str_end = s->str_start + current_size;
85  }
86 }
char * s
Definition: cu_in_wkt.c:23
void * lwrealloc(void *mem, size_t size)
Definition: lwutil.c:235

References lwrealloc(), and s.

Referenced by ptarray_to_wkt_sb(), stringbuffer_append_char(), stringbuffer_append_double(), stringbuffer_append_len(), and stringbuffer_avprintf().

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