Message ID | 20200825140927.16433-9-andreas.rheinhardt@gmail.com |
---|---|
State | Accepted |
Commit | 3ac3f393145f67e7dc0f8da2cc1ac9365befc3a8 |
Headers | show |
Series | [FFmpeg-devel,01/19] avfilter/avfilter: Fix indentation | expand |
Context | Check | Description |
---|---|---|
andriy/default | pending | |
andriy/make | success | Make finished |
andriy/make_fate | success | Make fate finished |
On 8/25/20, Andreas Rheinhardt <andreas.rheinhardt@gmail.com> wrote: > These names are always the same, so not using duplicates saves > allocations, checks for the allocations as well as frees. > > Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> > --- > libavfilter/vf_bm3d.c | 19 ++++--------------- > 1 file changed, 4 insertions(+), 15 deletions(-) > LGTM > diff --git a/libavfilter/vf_bm3d.c b/libavfilter/vf_bm3d.c > index e5d2b8bc63..18d13b25ff 100644 > --- a/libavfilter/vf_bm3d.c > +++ b/libavfilter/vf_bm3d.c > @@ -942,27 +942,19 @@ static av_cold int init(AVFilterContext *ctx) > } > > pad.type = AVMEDIA_TYPE_VIDEO; > - pad.name = av_strdup("source"); > + pad.name = "source"; > pad.config_props = config_input; > - if (!pad.name) > - return AVERROR(ENOMEM); > > - if ((ret = ff_insert_inpad(ctx, 0, &pad)) < 0) { > - av_freep(&pad.name); > + if ((ret = ff_insert_inpad(ctx, 0, &pad)) < 0) > return ret; > - } > > if (s->ref) { > pad.type = AVMEDIA_TYPE_VIDEO; > - pad.name = av_strdup("reference"); > + pad.name = "reference"; > pad.config_props = NULL; > - if (!pad.name) > - return AVERROR(ENOMEM); > > - if ((ret = ff_insert_inpad(ctx, 1, &pad)) < 0) { > - av_freep(&pad.name); > + if ((ret = ff_insert_inpad(ctx, 1, &pad)) < 0) > return ret; > - } > } > > return 0; > @@ -1027,9 +1019,6 @@ static av_cold void uninit(AVFilterContext *ctx) > BM3DContext *s = ctx->priv; > int i; > > - for (i = 0; i < ctx->nb_inputs; i++) > - av_freep(&ctx->input_pads[i].name); > - > if (s->ref) > ff_framesync_uninit(&s->fs); > > -- > 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 --git a/libavfilter/vf_bm3d.c b/libavfilter/vf_bm3d.c index e5d2b8bc63..18d13b25ff 100644 --- a/libavfilter/vf_bm3d.c +++ b/libavfilter/vf_bm3d.c @@ -942,27 +942,19 @@ static av_cold int init(AVFilterContext *ctx) } pad.type = AVMEDIA_TYPE_VIDEO; - pad.name = av_strdup("source"); + pad.name = "source"; pad.config_props = config_input; - if (!pad.name) - return AVERROR(ENOMEM); - if ((ret = ff_insert_inpad(ctx, 0, &pad)) < 0) { - av_freep(&pad.name); + if ((ret = ff_insert_inpad(ctx, 0, &pad)) < 0) return ret; - } if (s->ref) { pad.type = AVMEDIA_TYPE_VIDEO; - pad.name = av_strdup("reference"); + pad.name = "reference"; pad.config_props = NULL; - if (!pad.name) - return AVERROR(ENOMEM); - if ((ret = ff_insert_inpad(ctx, 1, &pad)) < 0) { - av_freep(&pad.name); + if ((ret = ff_insert_inpad(ctx, 1, &pad)) < 0) return ret; - } } return 0; @@ -1027,9 +1019,6 @@ static av_cold void uninit(AVFilterContext *ctx) BM3DContext *s = ctx->priv; int i; - for (i = 0; i < ctx->nb_inputs; i++) - av_freep(&ctx->input_pads[i].name); - if (s->ref) ff_framesync_uninit(&s->fs);
These names are always the same, so not using duplicates saves allocations, checks for the allocations as well as frees. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> --- libavfilter/vf_bm3d.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-)