6 int vbufprintf(struct print_buf
*buf
, const char *format
, va_list ap
)
12 rv
= vsnprintf(NULL
, 0, format
, ap
);
14 /* >= to make sure we have space for terminating null */
15 if (rv
+ buf
->len
>= buf
->size
) {
16 size_t newsize
= rv
+ buf
->len
+ BUFPAD
;
19 newbuf
= realloc(buf
->buf
, newsize
);
29 rv
= vsnprintf(buf
->buf
+ buf
->len
, buf
->size
- buf
->len
, format
, ap2
);
36 int bufprintf(struct print_buf
*buf
, const char *format
, ...)
42 rv
= vbufprintf(buf
, format
, ap
);