[vlc-devel] [PATCH 1/4] oldmovie: remove dynamic allocation
Steve Lhomme
robux4 at ycbcr.xyz
Mon Sep 21 09:12:02 CEST 2020
patchset LGTM
On 2020-09-20 18:00, Alexandre Janniaux wrote:
> ---
> modules/video_filter/oldmovie.c | 17 +++--------------
> 1 file changed, 3 insertions(+), 14 deletions(-)
>
> diff --git a/modules/video_filter/oldmovie.c b/modules/video_filter/oldmovie.c
> index f7c6a710fc..11bb87981f 100644
> --- a/modules/video_filter/oldmovie.c
> +++ b/modules/video_filter/oldmovie.c
> @@ -114,9 +114,9 @@ typedef struct
> /* general data */
> bool b_init;
> size_t i_planes;
> - int32_t *i_height;
> - int32_t *i_width;
> - int32_t *i_visible_pitch;
> + int32_t i_height[VOUT_MAX_PLANES];
> + int32_t i_width[VOUT_MAX_PLANES];
> + int32_t i_visible_pitch[VOUT_MAX_PLANES];
> vlc_tick_t i_start_time;
> vlc_tick_t i_last_time;
> vlc_tick_t i_cur_time;
> @@ -311,14 +311,6 @@ static int oldmovie_allocate_data( filter_t *p_filter, picture_t *p_pic_in ) {
> * take into account different characteristics for each plane
> */
> p_sys->i_planes = p_pic_in->i_planes;
> - p_sys->i_height = calloc( p_sys->i_planes, sizeof(int32_t) );
> - p_sys->i_width = calloc( p_sys->i_planes, sizeof(int32_t) );
> - p_sys->i_visible_pitch = calloc( p_sys->i_planes, sizeof(int32_t) );
> -
> - if( unlikely( !p_sys->i_height || !p_sys->i_width || !p_sys->i_visible_pitch ) ) {
> - oldmovie_free_allocated_data( p_filter );
> - return VLC_ENOMEM;
> - }
>
> for (size_t i_p=0; i_p < p_sys->i_planes; i_p++) {
> p_sys->i_visible_pitch [i_p] = (int) p_pic_in->p[i_p].i_visible_pitch;
> @@ -345,9 +337,6 @@ static void oldmovie_free_allocated_data( filter_t *p_filter ) {
> FREENULL(p_sys->p_dust[i_d]);
>
> p_sys->i_planes = 0;
> - FREENULL( p_sys->i_height );
> - FREENULL( p_sys->i_width );
> - FREENULL( p_sys->i_visible_pitch );
> }
>
> /**
> --
> 2.28.0
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
>
More information about the vlc-devel
mailing list