}
static inline void buffer_reset(buffer_t *buf) {
- buf->len = 0;
- buf->data[0] = '\0';
+ if (buf->len) {
+ buf->len = 0;
+ buf->data[0] = '\0';
+ }
}
+ssize_t buffer_addvf(buffer_t *buf, const char *fmt, va_list)
+ __attribute__((format(printf, 2, 0)));
+
+ssize_t buffer_addf(buffer_t *buf, const char *fmt, ...)
+ __attribute__((format(printf, 2, 3)));
+
/****** LEGACY BUFFERS *******/