[FFmpeg-devel] [PATCH v4 03/11] fftools/textformat: Introduce common header and deduplicate code
Stefano Sabatini
stefasab at gmail.com
Mon Apr 21 20:28:42 EEST 2025
On date Sunday 2025-04-20 22:59:06 +0000, softworkz wrote:
> From: softworkz <softworkz at hotmail.com>
>
> Signed-off-by: softworkz <softworkz at hotmail.com>
first part should be good
[...]
> diff --git a/fftools/textformat/tw_avio.c b/fftools/textformat/tw_avio.c
> index d1b494b7b4..48868ebf5d 100644
> --- a/fftools/textformat/tw_avio.c
> +++ b/fftools/textformat/tw_avio.c
> @@ -56,14 +56,11 @@ static void io_put_str(AVTextWriterContext *wctx, const char *str)
> avio_write(ctx->avio_context, (const unsigned char *)str, (int)strlen(str));
> }
>
> -static void io_printf(AVTextWriterContext *wctx, const char *fmt, ...)
> +static void io_printf(AVTextWriterContext *wctx, const char *fmt, va_list vl)
> {
> IOWriterContext *ctx = wctx->priv;
> - va_list ap;
>
> - va_start(ap, fmt);
> - avio_vprintf(ctx->avio_context, fmt, ap);
> - va_end(ap);
> + avio_vprintf(ctx->avio_context, fmt, vl);
> }
>
>
> diff --git a/fftools/textformat/tw_buffer.c b/fftools/textformat/tw_buffer.c
> index f8b38414a6..f861722247 100644
> --- a/fftools/textformat/tw_buffer.c
> +++ b/fftools/textformat/tw_buffer.c
> @@ -56,14 +56,11 @@ static void buffer_put_str(AVTextWriterContext *wctx, const char *str)
> av_bprintf(ctx->buffer, "%s", str);
> }
>
> -static void buffer_printf(AVTextWriterContext *wctx, const char *fmt, ...)
> +static void buffer_printf(AVTextWriterContext *wctx, const char *fmt, va_list vl)
> {
> BufferWriterContext *ctx = wctx->priv;
>
> - va_list vargs;
> - va_start(vargs, fmt);
> - av_vbprintf(ctx->buffer, fmt, vargs);
> - va_end(vargs);
> + av_vbprintf(ctx->buffer, fmt, vl);
> }
>
>
> diff --git a/fftools/textformat/tw_stdout.c b/fftools/textformat/tw_stdout.c
> index 23de6f671f..dace55f38a 100644
> --- a/fftools/textformat/tw_stdout.c
> +++ b/fftools/textformat/tw_stdout.c
> @@ -53,13 +53,9 @@ static inline void stdout_put_str(AVTextWriterContext *wctx, const char *str)
> printf("%s", str);
> }
>
> -static inline void stdout_printf(AVTextWriterContext *wctx, const char *fmt, ...)
> +static inline void stdout_printf(AVTextWriterContext *wctx, const char *fmt, va_list vl)
> {
> - va_list ap;
> -
> - va_start(ap, fmt);
> - vprintf(fmt, ap);
> - va_end(ap);
> + vprintf(fmt, vl);
> }
This looks like a logically different change and I'd rather move to a
dedicated commit.
More information about the ffmpeg-devel
mailing list