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

Alexandre Janniaux ajanni at videolabs.io
Thu Jan 7 15:31:57 UTC 2021


---
 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



More information about the vlc-devel mailing list