[vlc-devel] [PATCH] transform: use ARRAY_SIZE for counting elements

Steve Lhomme robux4 at ycbcr.xyz
Fri Jan 8 06:36:13 UTC 2021


LGTM

On 2021-01-07 16:31, Alexandre Janniaux wrote:
> ---
>   modules/video_filter/transform.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/modules/video_filter/transform.c b/modules/video_filter/transform.c
> index 93cfaa9be5..473bd4f9fa 100644
> --- a/modules/video_filter/transform.c
> +++ b/modules/video_filter/transform.c
> @@ -257,9 +257,6 @@ static bool dsc_is_rotated(const transform_description_t *dsc)
>       return dsc->plane32 != dsc->yuyv;
>   }
>   
> -static const size_t n_transforms =
> -    sizeof (descriptions) / sizeof (descriptions[0]);
> -
>   typedef struct
>   {
>       const vlc_chroma_description_t *chroma;
> @@ -325,7 +322,7 @@ static int Open(filter_t *filter)
>       char *type_name = var_InheritString(filter, CFG_PREFIX"type");
>       const transform_description_t *dsc = NULL;
>   
> -    for (size_t i = 0; i < n_transforms; i++)
> +    for (size_t i = 0; i < ARRAY_SIZE(descriptions); i++)
>           if (type_name && !strcmp(descriptions[i].name, type_name)) {
>               dsc = &descriptions[i];
>               break;
> -- 
> 2.30.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