PostGIS  2.1.10dev-r@@SVN_REVISION@@
int stringbuffer_trim_trailing_white ( stringbuffer_t s)

Trims whitespace off the end of the stringbuffer.

Returns the number of characters trimmed.

Definition at line 262 of file stringbuffer.c.

References stringbuffer_t::str_end, and stringbuffer_t::str_start.

263 {
264  char *ptr = s->str_end;
265  int dist = 0;
266 
267  /* Roll backwards until we hit a non-space. */
268  while( ptr > s->str_start )
269  {
270  ptr--;
271  if( (*ptr == ' ') || (*ptr == '\t') )
272  {
273  continue;
274  }
275  else
276  {
277  ptr++;
278  dist = s->str_end - ptr;
279  *ptr = '\0';
280  s->str_end = ptr;
281  return dist;
282  }
283  }
284  return dist;
285 }
char * str_start
Definition: stringbuffer.h:53