[FFmpeg-devel] [PATCH 1/2] lavu/bprint: add av_bprint_reset().
Clément Bœsch
ubitux at gmail.com
Sun May 13 11:39:58 CEST 2012
FIXME: lavu minor bump.
---
libavutil/bprint.c | 8 ++++++++
libavutil/bprint.h | 5 +++++
2 files changed, 13 insertions(+)
diff --git a/libavutil/bprint.c b/libavutil/bprint.c
index 08383b2..3338588 100644
--- a/libavutil/bprint.c
+++ b/libavutil/bprint.c
@@ -119,6 +119,14 @@ void av_bprint_chars(AVBPrint *buf, char c, unsigned n)
av_bprint_grow(buf, n);
}
+void av_bprint_reset(AVBPrint *buf)
+{
+ if (buf->len) {
+ *buf->str = 0;
+ buf->len = 0;
+ }
+}
+
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
{
unsigned real_size = FFMIN(buf->len + 1, buf->size);
diff --git a/libavutil/bprint.h b/libavutil/bprint.h
index c5d750d..d1a7d96 100644
--- a/libavutil/bprint.h
+++ b/libavutil/bprint.h
@@ -110,6 +110,11 @@ void av_bprintf(AVBPrint *buf, const char *fmt, ...) av_printf_format(2, 3);
void av_bprint_chars(AVBPrint *buf, char c, unsigned n);
/**
+ * Reset the string to "" but keep internal allocated data.
+ */
+void av_bprint_reset(AVBPrint *buf);
+
+/**
* Test if the print buffer is complete (not truncated).
*
* It may have been truncated due to a memory allocation failure
--
1.7.10.1
More information about the ffmpeg-devel
mailing list