Mercurial > blahgd > experimental
changeset 1044:4053acf70698
static: use ARRAY_LEN instead of sentinel values to stop iteration
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> |
---|---|
date | Thu, 13 Aug 2020 10:41:08 -0400 |
parents | d956241c9be3 |
children | e719679a8439 |
files | static.c |
diffstat | 1 files changed, 1 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/static.c Sat Aug 08 15:58:51 2020 -0400 +++ b/static.c Thu Aug 13 10:41:08 2020 -0400 @@ -37,7 +37,6 @@ { "/favicon.ico", "image/png", URI_STATIC, }, { "/style.css", "text/css", URI_STATIC, }, { "/wiki.png", "image/png", URI_STATIC, }, - { NULL, NULL, URI_BAD, }, }; static const struct uri_info *get_uri_info(const char *path) @@ -50,7 +49,7 @@ if (hasdotdot(path)) return NULL; - for (i = 0; safe_uris[i].uri; i++) { + for (i = 0; i < ARRAY_LEN(safe_uris); i++) { if (!strcmp(safe_uris[i].uri, path)) return &safe_uris[i]; }