[vlc-commits] httpd: use ARRAY_SIZE()

Rémi Denis-Courmont git at videolan.org
Mon Jun 8 16:04:03 CEST 2020


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jun  6 19:48:27 2020 +0300| [3b59ec25349b97565e1f11a1b9e0a26ed108ac23] | committer: Rémi Denis-Courmont

httpd: use ARRAY_SIZE()

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

 src/network/httpd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/network/httpd.c b/src/network/httpd.c
index b27df0a2be..c2cd6afee3 100644
--- a/src/network/httpd.c
+++ b/src/network/httpd.c
@@ -1279,7 +1279,6 @@ msg_type[] =
     { "GET",           HTTPD_MSG_GET,          HTTPD_PROTO_HTTP },
     { "HEAD",          HTTPD_MSG_HEAD,         HTTPD_PROTO_HTTP },
     { "POST",          HTTPD_MSG_POST,         HTTPD_PROTO_HTTP },
-    { "",              HTTPD_MSG_NONE,         HTTPD_PROTO_NONE }
 };
 
 
@@ -1423,7 +1422,7 @@ static void httpd_ClientRecv(httpd_client_t *cl)
                 p = NULL;
                 cl->query.i_type = HTTPD_MSG_NONE;
 
-                for (unsigned i = 0; msg_type[i].name[0]; i++)
+                for (unsigned i = 0; i < ARRAY_SIZE(msg_type); i++)
                     if (!strncmp((char *)cl->p_buffer, msg_type[i].name,
                                 strlen(msg_type[i].name))) {
                         p = (char *)&cl->p_buffer[strlen(msg_type[i].name) + 1 ];



More information about the vlc-commits mailing list