Marton Balint via ffmpeg-devel (HE12025-08-24): > >From f8e83bce6269c95fbad90f34434ceb641bf753d5 Mon Sep 17 00:00:00 2001 > From: Marton Balint <c...@passwd.hu> > Date: Sun, 24 Aug 2025 21:42:54 +0200 > Subject: [PATCH 1/2] avutil/bprint: make av_bprintf use av_vbprintf > > No reason to duplicate the code. > > Signed-off-by: Marton Balint <c...@passwd.hu>
No objection. > --- > libavutil/bprint.c | 33 +++++++++------------------------ > 1 file changed, 9 insertions(+), 24 deletions(-) > > diff --git a/libavutil/bprint.c b/libavutil/bprint.c > index 4e9571715c..932c03ce50 100644 > --- a/libavutil/bprint.c > +++ b/libavutil/bprint.c > @@ -96,35 +96,12 @@ 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; > char *dst; > - int extra_len; > va_list vl; > + int extra_len; Uh? > > while (1) { > room = av_bprint_room(buf); > @@ -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; Regards, -- Nicolas George _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-le...@ffmpeg.org