[vlc-commits] transform: use ARRAY_SIZE for counting elements

Alexandre Janniaux git at videolan.org
Wed Jan 13 16:35:44 UTC 2021


vlc | branch: master | Alexandre Janniaux <ajanni at videolabs.io> | Thu Jan  7 16:27:41 2021 +0100| [1035d802004979c5800fe5c2cfa7254ebc0ec417] | committer: Alexandre Janniaux

transform: use ARRAY_SIZE for counting elements

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1035d802004979c5800fe5c2cfa7254ebc0ec417
---

 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;



More information about the vlc-commits mailing list