[FFmpeg-devel] [PATCH 1/4] avcodec/libaribb24, ttmlenc, avutil/tx: Remove redundant init of AVBPrint

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Wed Sep 13 22:44:29 EEST 2023


Andreas Rheinhardt:
> An AVBPrint is initialized via av_bprint_init() (or
> av_bprint_init_for_buffer()) which expects uninitialized
> AVBPrints; it is therefore not necessary to zero them before
> the actual initialization.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> ---
>  libavcodec/libaribb24.c | 2 +-
>  libavcodec/ttmlenc.c    | 2 +-
>  libavutil/tx.c          | 4 ++--
>  3 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/libaribb24.c b/libavcodec/libaribb24.c
> index 8032536b22..551be89ffd 100644
> --- a/libavcodec/libaribb24.c
> +++ b/libavcodec/libaribb24.c
> @@ -227,7 +227,7 @@ static int libaribb24_handle_regions(AVCodecContext *avctx, AVSubtitle *sub)
>      Libaribb24Context *b24 = avctx->priv_data;
>      const arib_buf_region_t *region = arib_decoder_get_regions(b24->decoder);
>      unsigned int profile_font_size = get_profile_font_size(avctx);
> -    AVBPrint buf = { 0 };
> +    AVBPrint buf;
>      int ret = 0;
>  
>      av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED);
> diff --git a/libavcodec/ttmlenc.c b/libavcodec/ttmlenc.c
> index fb05c38968..6a2ab23cab 100644
> --- a/libavcodec/ttmlenc.c
> +++ b/libavcodec/ttmlenc.c
> @@ -45,7 +45,7 @@ typedef struct {
>  static void ttml_text_cb(void *priv, const char *text, int len)
>  {
>      TTMLContext *s = priv;
> -    AVBPrint cur_line = { 0 };
> +    AVBPrint cur_line;
>      AVBPrint *buffer = &s->buffer;
>  
>      av_bprint_init(&cur_line, len, AV_BPRINT_SIZE_UNLIMITED);
> diff --git a/libavutil/tx.c b/libavutil/tx.c
> index 24b2015b44..d6740071b9 100644
> --- a/libavutil/tx.c
> +++ b/libavutil/tx.c
> @@ -595,7 +595,7 @@ static void print_type(AVBPrint *bp, enum AVTXType type)
>  
>  static void print_cd_info(const FFTXCodelet *cd, int prio, int len, int print_prio)
>  {
> -    AVBPrint bp = { 0 };
> +    AVBPrint bp;
>      av_bprint_init(&bp, 0, AV_BPRINT_SIZE_AUTOMATIC);
>  
>      av_bprintf(&bp, "%s - type: ", cd->name);
> @@ -718,7 +718,7 @@ av_cold int ff_tx_init_subtx(AVTXContext *s, enum AVTXType type,
>      int codelet_list_idx = codelet_list_num;
>      int nb_cd_matches = 0;
>  #if !CONFIG_SMALL
> -    AVBPrint bp = { 0 };
> +    AVBPrint bp;
>  #endif
>  
>      /* We still accept functions marked with SLOW, even if the CPU is

Will apply this patchset tomorrow unless there are objections.

- Andreas



More information about the ffmpeg-devel mailing list