[vlc-commits] demux/playlist: xspf: use ARRAY_SIZE

Filip Roséen git at videolan.org
Thu May 18 18:08:42 CEST 2017


vlc | branch: master | Filip Roséen <filip at atch.se> | Thu May 18 12:02:36 2017 +0200| [95c313e18558377ee49c84dc333d1722758e6d3a] | committer: Rémi Denis-Courmont

demux/playlist: xspf: use ARRAY_SIZE

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

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

 modules/demux/playlist/xspf.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/modules/demux/playlist/xspf.c b/modules/demux/playlist/xspf.c
index 68d54fa7c1..7845e0a9b5 100644
--- a/modules/demux/playlist/xspf.c
+++ b/modules/demux/playlist/xspf.c
@@ -34,6 +34,7 @@
 #include <vlc_demux.h>
 
 #include <vlc_xml.h>
+#include <vlc_arrays.h>
 #include <vlc_strings.h>
 #include <vlc_url.h>
 #include "playlist.h"
@@ -167,12 +168,12 @@ end:
 
 static const xml_elem_hnd_t *get_handler(const xml_elem_hnd_t *tab, size_t n, const char *name)
 {
-    for (size_t i = 0; i < n / sizeof(xml_elem_hnd_t); i++)
+    for (size_t i = 0; i < n; i++)
         if (!strcmp(name, tab[i].name))
             return &tab[i];
     return NULL;
 }
-#define get_handler(tab, name) get_handler(tab, sizeof tab, name)
+#define get_handler(tab, name) get_handler(tab, ARRAY_SIZE(tab), name)
 
 /**
  * \brief parse the root node of a XSPF playlist



More information about the vlc-commits mailing list