From 50e94aadb2d624407c46c988857a767dce5020b7 Mon Sep 17 00:00:00 2001 From: Marton Balint Date: Sun, 24 Aug 2025 21:42:54 +0200 Subject: [PATCH] avutil/bprint: make av_bprintf use av_vbprintf No reason to duplicate the code. Signed-off-by: Marton Balint --- libavutil/bprint.c | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/libavutil/bprint.c b/libavutil/bprint.c index 4e9571715c..ac07a17326 100644 --- a/libavutil/bprint.c +++ b/libavutil/bprint.c @@ -96,29 +96,6 @@ void av_bprint_init_for_buffer(AVBPrint *buf, char *buffer, unsigned size) *buf->str = 0; } -void av_bprintf(AVBPrint *buf, const char *fmt, ...) -{ - unsigned room; - char *dst; - va_list vl; - int extra_len; - - while (1) { - room = av_bprint_room(buf); - dst = room ? buf->str + buf->len : NULL; - va_start(vl, fmt); - extra_len = vsnprintf(dst, room, fmt, vl); - va_end(vl); - if (extra_len <= 0) - return; - if (extra_len < room) - break; - if (av_bprint_alloc(buf, extra_len)) - break; - } - av_bprint_grow(buf, extra_len); -} - void av_vbprintf(AVBPrint *buf, const char *fmt, va_list vl_arg) { unsigned room; @@ -142,6 +119,14 @@ void av_vbprintf(AVBPrint *buf, const char *fmt, va_list vl_arg) av_bprint_grow(buf, extra_len); } +void av_bprintf(AVBPrint *buf, const char *fmt, ...) +{ + va_list vl; + va_start(vl, fmt); + av_vbprintf(buf, fmt, vl); + va_end(vl); +} + void av_bprint_chars(AVBPrint *buf, char c, unsigned n) { unsigned room, real_n;