lib/output_buffer: harden buf_output_free() and kill buf_output_clear()
[fio.git] / lib / output_buffer.c
index c1fdfc95f610aca10ece35ebdc2dac437c01af66..f6c304bdf02efdfa6c229bfefdc6043002b72893 100644 (file)
@@ -3,7 +3,6 @@
 #include <stdlib.h>
 
 #include "output_buffer.h"
-#include "../log.h"
 #include "../minmax.h"
 
 #define BUF_INC        1024
@@ -18,6 +17,7 @@ void buf_output_init(struct buf_output *out)
 void buf_output_free(struct buf_output *out)
 {
        free(out->buf);
+       buf_output_init(out);
 }
 
 size_t buf_output_add(struct buf_output *out, const char *buf, size_t len)
@@ -40,16 +40,3 @@ size_t buf_output_add(struct buf_output *out, const char *buf, size_t len)
        out->buflen += len;
        return len;
 }
-
-size_t buf_output_flush(struct buf_output *out)
-{
-       size_t ret = 0;
-
-       if (out->buflen) {
-               ret = log_info_buf(out->buf, out->buflen);
-               memset(out->buf, 0, out->max_buflen);
-               out->buflen = 0;
-       }
-
-       return ret;
-}