From 6cbee37a583ca20488228c38625fcfbd55234daf Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Wed, 22 Nov 2017 12:27:19 +0800 Subject: [PATCH] apps/httpd: Use LWIP_ARRAYSIZE at appropriate places Signed-off-by: Axel Lin Signed-off-by: goldsimon --- src/apps/httpd/httpd.c | 3 +-- src/apps/httpd/httpd_structs.h | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/apps/httpd/httpd.c b/src/apps/httpd/httpd.c index 2a58f71f..0ac8d492 100644 --- a/src/apps/httpd/httpd.c +++ b/src/apps/httpd/httpd.c @@ -159,8 +159,7 @@ const default_filename g_psDefaultFilenames[] = { {"/index.htm", 0 } }; -#define NUM_DEFAULT_FILENAMES (sizeof(g_psDefaultFilenames) / \ - sizeof(default_filename)) +#define NUM_DEFAULT_FILENAMES LWIP_ARRAYSIZE(g_psDefaultFilenames) #if LWIP_HTTPD_SUPPORT_REQUESTLIST /** HTTP request is copied here from pbufs for simple parsing */ diff --git a/src/apps/httpd/httpd_structs.h b/src/apps/httpd/httpd_structs.h index 0dfee775..590af4b7 100644 --- a/src/apps/httpd/httpd_structs.h +++ b/src/apps/httpd/httpd_structs.h @@ -109,7 +109,7 @@ static const tHTTPHeader g_psHTTPHeaders[] = { #endif }; -#define NUM_HTTP_HEADERS (sizeof(g_psHTTPHeaders) / sizeof(tHTTPHeader)) +#define NUM_HTTP_HEADERS LWIP_ARRAYSIZE(g_psHTTPHeaders) #endif /* LWIP_HTTPD_DYNAMIC_HEADERS */ @@ -117,7 +117,7 @@ static const tHTTPHeader g_psHTTPHeaders[] = { static const char *const g_pcSSIExtensions[] = { ".shtml", ".shtm", ".ssi", ".xml" }; -#define NUM_SHTML_EXTENSIONS (sizeof(g_pcSSIExtensions) / sizeof(const char *)) +#define NUM_SHTML_EXTENSIONS LWIP_ARRAYSIZE(g_pcSSIExtensions) #endif /* LWIP_HTTPD_SSI */ #endif /* LWIP_HTTPD_STRUCTS_H */