apps/httpd: Use LWIP_ARRAYSIZE at appropriate places

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
This commit is contained in:
Axel Lin 2017-11-22 12:27:19 +08:00 committed by goldsimon
parent 5cd6c38893
commit 6cbee37a58
2 changed files with 3 additions and 4 deletions

View File

@ -159,8 +159,7 @@ const default_filename g_psDefaultFilenames[] = {
{"/index.htm", 0 } {"/index.htm", 0 }
}; };
#define NUM_DEFAULT_FILENAMES (sizeof(g_psDefaultFilenames) / \ #define NUM_DEFAULT_FILENAMES LWIP_ARRAYSIZE(g_psDefaultFilenames)
sizeof(default_filename))
#if LWIP_HTTPD_SUPPORT_REQUESTLIST #if LWIP_HTTPD_SUPPORT_REQUESTLIST
/** HTTP request is copied here from pbufs for simple parsing */ /** HTTP request is copied here from pbufs for simple parsing */

View File

@ -109,7 +109,7 @@ static const tHTTPHeader g_psHTTPHeaders[] = {
#endif #endif
}; };
#define NUM_HTTP_HEADERS (sizeof(g_psHTTPHeaders) / sizeof(tHTTPHeader)) #define NUM_HTTP_HEADERS LWIP_ARRAYSIZE(g_psHTTPHeaders)
#endif /* LWIP_HTTPD_DYNAMIC_HEADERS */ #endif /* LWIP_HTTPD_DYNAMIC_HEADERS */
@ -117,7 +117,7 @@ static const tHTTPHeader g_psHTTPHeaders[] = {
static const char *const g_pcSSIExtensions[] = { static const char *const g_pcSSIExtensions[] = {
".shtml", ".shtm", ".ssi", ".xml" ".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_SSI */
#endif /* LWIP_HTTPD_STRUCTS_H */ #endif /* LWIP_HTTPD_STRUCTS_H */