1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-11-23 21:54:53 +02:00

avutil/bprint: make av_bprintf use av_vbprintf

No reason to duplicate the code.

Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
Marton Balint
2025-08-24 21:42:54 +02:00
parent 16d32a1c1d
commit 50e94aadb2

View File

@@ -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;