From d650a434b27a35cf217bb8b20f4092c4876a489d Mon Sep 17 00:00:00 2001 From: Laurent MONIN Date: Tue, 11 Sep 2007 09:30:26 +0200 Subject: [PATCH] Extend Use of LWS() macro to parse_old_meta_refresh(). --- src/document/html/parser.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/document/html/parser.c b/src/document/html/parser.c index cdc8745c..8a3dded5 100644 --- a/src/document/html/parser.c +++ b/src/document/html/parser.c @@ -270,6 +270,8 @@ html_skip(struct html_context *html_context, unsigned char *a) html_top->type = ELEMENT_DONT_KILL; } +#define LWS(c) ((c) == ' ' || (c) == ASCII_TAB) + /* Parse meta refresh without URL= in it: * * @@ -285,18 +287,18 @@ parse_old_meta_refresh(unsigned char *str, unsigned char **ret) if_assert_failed return; *ret = NULL; - while (*p && (*p == ' ' || *p == ASCII_TAB)) p++; + while (*p && LWS(*p)) p++; if (!*p) return; while (*p && *p >= '0' && *p <= '9') p++; if (!*p) return; - while (*p && (*p == ' ' || *p == ASCII_TAB)) p++; + while (*p && LWS(*p)) p++; if (!*p) return; if (*p == ';' || *p == ',') p++; else return; - while (*p && (*p == ' ' || *p == ASCII_TAB)) p++; + while (*p && LWS(*p)) p++; if (!*p) return; len = strlen(p); - while (len && (p[len] == ' ' || p[len] == ASCII_TAB)) len--; + while (len && LWS(p[len])) len--; if (len) *ret = memacpy(p, len); } @@ -321,7 +323,6 @@ parse_old_meta_refresh(unsigned char *str, unsigned char **ret) static enum parse_header_param search_for_url_param(unsigned char *str, unsigned char **ret) { -#define LWS(c) ((c) == ' ' || (c) == ASCII_TAB) unsigned char *p; int plen = 0; @@ -372,9 +373,10 @@ search_for_url_param(unsigned char *str, unsigned char **ret) return HEADER_PARAM_OUT_OF_MEMORY; } return HEADER_PARAM_FOUND; -#undef LWS } +#undef LWS + static void check_head_for_refresh(struct html_context *html_context, unsigned char *head) {