[FFmpeg-cvslog] lavu/bprint: add av_bprint_reset().
Clément Bœsch
git at videolan.org
Mon May 14 19:20:16 CEST 2012
ffmpeg | branch: master | Clément Bœsch <ubitux at gmail.com> | Sun May 13 11:38:19 2012 +0200| [9548deeea9434732a718749ae931be53caba2c30] | committer: Clément Bœsch
lavu/bprint: add av_bprint_reset().
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9548deeea9434732a718749ae931be53caba2c30
---
libavutil/avutil.h | 2 +-
libavutil/bprint.c | 8 ++++++++
libavutil/bprint.h | 5 +++++
3 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/libavutil/avutil.h b/libavutil/avutil.h
index a85f6fb..2491264 100644
--- a/libavutil/avutil.h
+++ b/libavutil/avutil.h
@@ -153,7 +153,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 51
-#define LIBAVUTIL_VERSION_MINOR 50
+#define LIBAVUTIL_VERSION_MINOR 51
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
diff --git a/libavutil/bprint.c b/libavutil/bprint.c
index 08383b2..115bf0c 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_clear(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..ad65afe 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_clear(AVBPrint *buf);
+
+/**
* Test if the print buffer is complete (not truncated).
*
* It may have been truncated due to a memory allocation failure
More information about the ffmpeg-cvslog
mailing list