diff mbox series

[FFmpeg-devel,07/19] avfilter/src_movie: Avoid intermediate buffer for writing string

Message ID 20200825140927.16433-7-andreas.rheinhardt@gmail.com
State Accepted
Commit a97d8469a64b9416ad4f92ce503ad219470cbe7b
Headers show
Series [FFmpeg-devel,01/19] avfilter/avfilter: Fix indentation
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Aug. 25, 2020, 2:09 p.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavfilter/src_movie.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Paul B Mahol Aug. 30, 2020, 7:29 p.m. UTC | #1
On 8/25/20, Andreas Rheinhardt <andreas.rheinhardt@gmail.com> wrote:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavfilter/src_movie.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>

LGTM

> diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
> index 64d82e9df1..eeb8609855 100644
> --- a/libavfilter/src_movie.c
> +++ b/libavfilter/src_movie.c
> @@ -213,7 +213,6 @@ static av_cold int movie_common_init(AVFilterContext
> *ctx)
>      int64_t timestamp;
>      int nb_streams = 1, ret, i;
>      char default_streams[16], *stream_specs, *spec, *cursor;
> -    char name[16];
>      AVStream *st;
>
>      if (!movie->file_name) {
> @@ -305,9 +304,8 @@ static av_cold int movie_common_init(AVFilterContext
> *ctx)
>      for (i = 0; i < nb_streams; i++) {
>          AVFilterPad pad = { 0 };
>          movie->out_index[movie->st[i].st->index] = i;
> -        snprintf(name, sizeof(name), "out%d", i);
>          pad.type          = movie->st[i].st->codecpar->codec_type;
> -        pad.name          = av_strdup(name);
> +        pad.name          = av_asprintf("out%d", i);
>          if (!pad.name)
>              return AVERROR(ENOMEM);
>          pad.config_props  = movie_config_output_props;
> --
> 2.20.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
index 64d82e9df1..eeb8609855 100644
--- a/libavfilter/src_movie.c
+++ b/libavfilter/src_movie.c
@@ -213,7 +213,6 @@  static av_cold int movie_common_init(AVFilterContext *ctx)
     int64_t timestamp;
     int nb_streams = 1, ret, i;
     char default_streams[16], *stream_specs, *spec, *cursor;
-    char name[16];
     AVStream *st;
 
     if (!movie->file_name) {
@@ -305,9 +304,8 @@  static av_cold int movie_common_init(AVFilterContext *ctx)
     for (i = 0; i < nb_streams; i++) {
         AVFilterPad pad = { 0 };
         movie->out_index[movie->st[i].st->index] = i;
-        snprintf(name, sizeof(name), "out%d", i);
         pad.type          = movie->st[i].st->codecpar->codec_type;
-        pad.name          = av_strdup(name);
+        pad.name          = av_asprintf("out%d", i);
         if (!pad.name)
             return AVERROR(ENOMEM);
         pad.config_props  = movie_config_output_props;