cleanup style in parser

Signed-off-by: Andy Green <andy.green@linaro.org>
This commit is contained in:
Andy Green 2014-08-19 18:34:31 +08:00
parent fc9871ec24
commit 4b812fe4aa

View file

@ -317,8 +317,8 @@ int libwebsocket_parse(
if (c == '.') { if (c == '.') {
wsi->u.hdr.ups = URIPS_SEEN_SLASH_DOT; wsi->u.hdr.ups = URIPS_SEEN_SLASH_DOT;
goto swallow; goto swallow;
} else }
wsi->u.hdr.ups = URIPS_IDLE; wsi->u.hdr.ups = URIPS_IDLE;
break; break;
case URIPS_SEEN_SLASH_DOT: case URIPS_SEEN_SLASH_DOT:
/* swallow second . */ /* swallow second . */
@ -357,8 +357,8 @@ int libwebsocket_parse(
/* last issued was /, so another / == // */ /* last issued was /, so another / == // */
if (c == '/') if (c == '/')
goto swallow; goto swallow;
else /* last we issued was / so SEEN_SLASH */ /* last we issued was / so SEEN_SLASH */
wsi->u.hdr.ups = URIPS_SEEN_SLASH; wsi->u.hdr.ups = URIPS_SEEN_SLASH;
break; break;
case URIPS_ARGUMENTS: case URIPS_ARGUMENTS:
/* leave them alone */ /* leave them alone */
@ -397,15 +397,12 @@ check_eol:
lwsl_parser("*\n"); lwsl_parser("*\n");
} }
{ n = issue_char(wsi, c);
int issue_result = issue_char(wsi, c); if (n < 0)
if (issue_result < 0) { return -1;
return -1; if (n > 0)
} wsi->u.hdr.parser_state = WSI_TOKEN_SKIPPING;
else if(issue_result > 0) {
wsi->u.hdr.parser_state = WSI_TOKEN_SKIPPING;
};
};
swallow: swallow:
/* per-protocol end of headers management */ /* per-protocol end of headers management */