buffer_ensure(buf, BUFSIZ);
len = vsnprintf(buf->data + buf->len, buf->size - buf->len, fmt, args);
- if (len < 0) {
- len = 0;
- }
+ if (len < 0)
+ return len;
if (len >= buf->size - buf->len) {
buffer_ensure(buf, len);
vsnprintf(buf->data + buf->len, buf->size - buf->len, fmt, ap);
return len;
}
-ssize_t buffer_addf(buffer_t *buf, const char *fmt, ...) {
+ssize_t buffer_addf(buffer_t *buf, const char *fmt, ...)
+{
ssize_t res;
va_list args;
va_start(args, fmt);