char* buffer_release( growing_buffer* gb );
int buffer_free( growing_buffer* gb );
int buffer_add_char(growing_buffer* gb, char c);
+int buffer_chomp(growing_buffer* gb); // removes the last character from the buffer
/* returns the size needed to fill in the vsnprintf buffer.
* ! this calls va_end on the va_list argument*
return strdup( gb->buf );
}
+int buffer_chomp(growing_buffer* gb) {
+ if( gb == NULL ) { return -1; }
+ if(gb->n_used > 0) {
+ gb->n_used--;
+ gb->buf[gb->n_used] = '\0';
+ }
+ return gb->n_used;
+}
+
/*
#define OSRF_BUFFER_ADD_CHAR(gb, c)\