PostGIS  3.0.0dev-r@@SVN_REVISION@@

◆ stringbuffer_getstringcopy()

char* stringbuffer_getstringcopy ( stringbuffer_t s)

Returns a newly allocated string large enough to contain the current state of the string.

Caller is responsible for freeing the return value.

Definition at line 124 of file stringbuffer.c.

References lwalloc(), stringbuffer_t::str_end, and stringbuffer_t::str_start.

Referenced by lwgeom_to_kml2(), lwgeom_to_wkt(), lwgeom_to_x3d3(), nd_box_to_json(), nd_stats_to_json(), and pointarray_to_encoded_polyline().

125 {
126  size_t size = (s->str_end - s->str_start) + 1;
127  char *str = lwalloc(size);
128  memcpy(str, s->str_start, size);
129  str[size - 1] = '\0';
130  return str;
131 }
char * str_start
Definition: stringbuffer.h:43
void * lwalloc(size_t size)
Definition: lwutil.c:227
Here is the call graph for this function:
Here is the caller graph for this function: