From f2c26ee500ab3921010fa7ec66243365611e77dd Mon Sep 17 00:00:00 2001 From: Jonathan Marler Date: Mon, 14 Mar 2016 18:24:41 -0600 Subject: [PATCH] src: put `assert()` after var declarations Microsoft C++ compiler fails when this assert appears before the declarations. Moved assert to appear after the declarations. PR-URL: https://github.com/nodejs/http-parser/pull/293 Reviewed-By: Fedor Indutny --- http_parser.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/http_parser.c b/http_parser.c index 7196175..3c896ff 100644 --- a/http_parser.c +++ b/http_parser.c @@ -2253,12 +2253,13 @@ http_parse_host_char(enum http_host_state s, const char ch) { static int http_parse_host(const char * buf, struct http_parser_url *u, int found_at) { - assert(u->field_set & (1 << UF_HOST)); enum http_host_state s; const char *p; size_t buflen = u->field_data[UF_HOST].off + u->field_data[UF_HOST].len; + assert(u->field_set & (1 << UF_HOST)); + u->field_data[UF_HOST].len = 0; s = found_at ? s_http_userinfo_start : s_http_host_start;