5 #include "output_buffer.h"
10 void buf_output_init(struct buf_output *out)
17 void buf_output_free(struct buf_output *out)
22 size_t buf_output_add(struct buf_output *out, const char *buf, size_t len)
24 while (out->max_buflen - out->buflen < len) {
25 size_t old_max = out->max_buflen;
27 out->max_buflen += BUF_INC;
28 out->buf = realloc(out->buf, out->max_buflen);
29 memset(&out->buf[old_max], 0, BUF_INC);
32 memcpy(&out->buf[out->buflen], buf, len);
37 size_t buf_output_flush(struct buf_output *out)
42 ret = log_info_buf(out->buf, out->buflen);
43 memset(out->buf, 0, out->max_buflen);