please review the patch attached cheers, Ilya Shipitsin
From 4ca8083844bc6fa1f06d3e8b85158dba64372f5c Mon Sep 17 00:00:00 2001 From: Ilya Shipitsin <[email protected]> Date: Thu, 29 Mar 2018 15:09:05 +0500 Subject: [PATCH] MINOR / CLEANUP: src/h1.c: remove unused labels
issue detected by cppcheck [src/h1.c:188]: (warning) Label 'http_msg_rpver' is not used. Should this be a 'case' of the enclosing switch()? [src/h1.c:201]: (warning) Label 'http_msg_rpver_sp' is not used. Should this be a 'case' of the enclosing switch()? [src/h1.c:232]: (warning) Label 'http_msg_rpcode_sp' is not used. Should this be a 'case' of the enclosing switch()? [src/h1.c:301]: (warning) Label 'http_msg_rqmeth' is not used. Should this be a 'case' of the enclosing switch()? [src/h1.c:327]: (warning) Label 'http_msg_rqmeth_sp' is not used. Should this be a 'case' of the enclosing switch()? [src/h1.c:359]: (warning) Label 'http_msg_rquri2' is not used. Should this be a 'case' of the enclosing switch()? [src/h1.c:393]: (warning) Label 'http_msg_rquri_sp' is not used. Should this be a 'case' of the enclosing switch()? [src/h1.c:476]: (warning) Label 'http_msg_rpbefore' is not used. Should this be a 'case' of the enclosing switch()? [src/h1.c:506]: (warning) Label 'http_msg_rpbefore_cr' is not used. Should this be a 'case' of the enclosing switch()? [src/h1.c:544]: (warning) Label 'http_msg_rqbefore' is not used. Should this be a 'case' of the enclosing switch()? [src/h1.c:573]: (warning) Label 'http_msg_rqbefore_cr' is not used. Should this be a 'case' of the enclosing switch()? [src/h1.c:616]: (warning) Label 'http_msg_hdr_first' is not used. Should this be a 'case' of the enclosing switch()? [src/h1.c:669]: (warning) Label 'http_msg_hdr_l1_lws' is not used. Should this be a 'case' of the enclosing switch()? [src/h1.c:711]: (warning) Label 'http_msg_hdr_val2' is not used. Should this be a 'case' of the enclosing switch()? [src/h1.c:730]: (warning) Label 'http_msg_hdr_l2_lws' is not used. Should this be a 'case' of the enclosing switch()? [src/h1.c:855]: (warning) Label 'http_msg_rpbefore' is not used. Should this be a 'case' of the enclosing switch()? [src/h1.c:880]: (warning) Label 'http_msg_rpbefore_cr' is not used. Should this be a 'case' of the enclosing switch()? [src/h1.c:898]: (warning) Label 'http_msg_rpver_sp' is not used. Should this be a 'case' of the enclosing switch()? [src/h1.c:936]: (warning) Label 'http_msg_rpcode_sp' is not used. Should this be a 'case' of the enclosing switch()? [src/h1.c:980]: (warning) Label 'http_msg_hdr_first' is not used. Should this be a 'case' of the enclosing switch()? [src/h1.c:1040]: (warning) Label 'http_msg_hdr_l1_lws' is not used. Should this be a 'case' of the enclosing switch()? [src/h1.c:1082]: (warning) Label 'http_msg_hdr_val2' is not used. Should this be a 'case' of the enclosing switch()? [src/h1.c:1101]: (warning) Label 'http_msg_hdr_l2_lws' is not used. Should this be a 'case' of the enclosing switch()? Signed-off-by: Ilya Shipitsin <[email protected]> --- src/h1.c | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/src/h1.c b/src/h1.c index d3a20c2e..650d25a7 100644 --- a/src/h1.c +++ b/src/h1.c @@ -185,7 +185,6 @@ const char *http_parse_stsline(struct http_msg *msg, switch (state) { case HTTP_MSG_RPVER: - http_msg_rpver: if (likely(HTTP_IS_VER_TOKEN(*ptr))) EAT_AND_JUMP_OR_RETURN(ptr, end, http_msg_rpver, http_msg_ood, state, HTTP_MSG_RPVER); @@ -198,7 +197,6 @@ const char *http_parse_stsline(struct http_msg *msg, break; case HTTP_MSG_RPVER_SP: - http_msg_rpver_sp: if (likely(!HTTP_IS_LWS(*ptr))) { msg->sl.st.c = ptr - msg_start; goto http_msg_rpcode; @@ -229,7 +227,6 @@ const char *http_parse_stsline(struct http_msg *msg, goto http_msg_rpline_eol; case HTTP_MSG_RPCODE_SP: - http_msg_rpcode_sp: if (likely(!HTTP_IS_LWS(*ptr))) { msg->sl.st.r = ptr - msg_start; goto http_msg_rpreason; @@ -298,7 +295,6 @@ const char *http_parse_reqline(struct http_msg *msg, switch (state) { case HTTP_MSG_RQMETH: - http_msg_rqmeth: if (likely(HTTP_IS_TOKEN(*ptr))) EAT_AND_JUMP_OR_RETURN(ptr, end, http_msg_rqmeth, http_msg_ood, state, HTTP_MSG_RQMETH); @@ -324,7 +320,6 @@ const char *http_parse_reqline(struct http_msg *msg, break; case HTTP_MSG_RQMETH_SP: - http_msg_rqmeth_sp: if (likely(!HTTP_IS_LWS(*ptr))) { msg->sl.rq.u = ptr - msg_start; goto http_msg_rquri; @@ -356,7 +351,6 @@ const char *http_parse_reqline(struct http_msg *msg, state = HTTP_MSG_RQURI; goto http_msg_ood; } - http_msg_rquri2: if (likely((unsigned char)(*ptr - 33) <= 93)) /* 33 to 126 included */ EAT_AND_JUMP_OR_RETURN(ptr, end, http_msg_rquri2, http_msg_ood, state, HTTP_MSG_RQURI); @@ -390,7 +384,6 @@ const char *http_parse_reqline(struct http_msg *msg, break; case HTTP_MSG_RQURI_SP: - http_msg_rquri_sp: if (likely(!HTTP_IS_LWS(*ptr))) { msg->sl.rq.v = ptr - msg_start; goto http_msg_rqver; @@ -473,7 +466,6 @@ void http_msg_analyzer(struct http_msg *msg, struct hdr_idx *idx) * closer to each other (accessed more often). */ case HTTP_MSG_RPBEFORE: - http_msg_rpbefore: if (likely(HTTP_IS_TOKEN(*ptr))) { /* we have a start of message, but we have to check * first if we need to remove some CRLF. We can only @@ -503,7 +495,6 @@ void http_msg_analyzer(struct http_msg *msg, struct hdr_idx *idx) /* stop here */ case HTTP_MSG_RPBEFORE_CR: - http_msg_rpbefore_cr: EXPECT_LF_HERE(ptr, http_msg_invalid, state, HTTP_MSG_RPBEFORE_CR); EAT_AND_JUMP_OR_RETURN(ptr, end, http_msg_rpbefore, http_msg_ood, state, HTTP_MSG_RPBEFORE); /* stop here */ @@ -541,7 +532,6 @@ void http_msg_analyzer(struct http_msg *msg, struct hdr_idx *idx) * Second, states that are specific to the request only */ case HTTP_MSG_RQBEFORE: - http_msg_rqbefore: if (likely(HTTP_IS_TOKEN(*ptr))) { /* we have a start of message, but we have to check * first if we need to remove some CRLF. We can only @@ -570,7 +560,6 @@ void http_msg_analyzer(struct http_msg *msg, struct hdr_idx *idx) /* stop here */ case HTTP_MSG_RQBEFORE_CR: - http_msg_rqbefore_cr: EXPECT_LF_HERE(ptr, http_msg_invalid, state, HTTP_MSG_RQBEFORE_CR); EAT_AND_JUMP_OR_RETURN(ptr, end, http_msg_rqbefore, http_msg_ood, state, HTTP_MSG_RQBEFORE); /* stop here */ @@ -613,7 +602,6 @@ void http_msg_analyzer(struct http_msg *msg, struct hdr_idx *idx) * Common states below */ case HTTP_MSG_HDR_FIRST: - http_msg_hdr_first: msg->sol = ptr - buf->p; if (likely(!HTTP_IS_CRLF(*ptr))) { goto http_msg_hdr_name; @@ -666,7 +654,6 @@ void http_msg_analyzer(struct http_msg *msg, struct hdr_idx *idx) EAT_AND_JUMP_OR_RETURN(ptr, end, http_msg_hdr_l1_lws, http_msg_ood, state, HTTP_MSG_HDR_L1_LWS); case HTTP_MSG_HDR_L1_LWS: - http_msg_hdr_l1_lws: if (likely(HTTP_IS_SPHT(*ptr))) { /* replace HT,CR,LF with spaces */ for (; buf->p + msg->sov < ptr; msg->sov++) @@ -708,7 +695,6 @@ void http_msg_analyzer(struct http_msg *msg, struct hdr_idx *idx) state = HTTP_MSG_HDR_VAL; goto http_msg_ood; } - http_msg_hdr_val2: if (likely(!HTTP_IS_CRLF(*ptr))) EAT_AND_JUMP_OR_RETURN(ptr, end, http_msg_hdr_val2, http_msg_ood, state, HTTP_MSG_HDR_VAL); @@ -727,7 +713,6 @@ void http_msg_analyzer(struct http_msg *msg, struct hdr_idx *idx) EAT_AND_JUMP_OR_RETURN(ptr, end, http_msg_hdr_l2_lws, http_msg_ood, state, HTTP_MSG_HDR_L2_LWS); case HTTP_MSG_HDR_L2_LWS: - http_msg_hdr_l2_lws: if (unlikely(HTTP_IS_SPHT(*ptr))) { /* LWS: replace HT,CR,LF with spaces */ for (; buf->p + msg->eol < ptr; msg->eol++) @@ -852,7 +837,6 @@ int h1_headers_to_hdr_list(char *start, const char *stop, switch (state) { case HTTP_MSG_RPBEFORE: - http_msg_rpbefore: if (likely(HTTP_IS_TOKEN(*ptr))) { /* we have a start of message, we may have skipped some * heading CRLF. Skip them now. @@ -877,7 +861,6 @@ int h1_headers_to_hdr_list(char *start, const char *stop, /* stop here */ case HTTP_MSG_RPBEFORE_CR: - http_msg_rpbefore_cr: EXPECT_LF_HERE(ptr, http_msg_invalid, state, HTTP_MSG_RPBEFORE_CR); EAT_AND_JUMP_OR_RETURN(ptr, end, http_msg_rpbefore, http_msg_ood, state, HTTP_MSG_RPBEFORE); /* stop here */ @@ -895,7 +878,6 @@ int h1_headers_to_hdr_list(char *start, const char *stop, goto http_msg_invalid; case HTTP_MSG_RPVER_SP: - http_msg_rpver_sp: if (likely(!HTTP_IS_LWS(*ptr))) { code = 0; st_c = ptr - start; @@ -933,7 +915,6 @@ int h1_headers_to_hdr_list(char *start, const char *stop, goto http_msg_rpline_eol; case HTTP_MSG_RPCODE_SP: - http_msg_rpcode_sp: if (likely(!HTTP_IS_LWS(*ptr))) { /* reason = ptr - start */ goto http_msg_rpreason; @@ -977,7 +958,6 @@ int h1_headers_to_hdr_list(char *start, const char *stop, /* stop here */ case HTTP_MSG_HDR_FIRST: - http_msg_hdr_first: sol = ptr - start; if (likely(!HTTP_IS_CRLF(*ptr))) { goto http_msg_hdr_name; @@ -1037,7 +1017,6 @@ int h1_headers_to_hdr_list(char *start, const char *stop, EAT_AND_JUMP_OR_RETURN(ptr, end, http_msg_hdr_l1_lws, http_msg_ood, state, HTTP_MSG_HDR_L1_LWS); case HTTP_MSG_HDR_L1_LWS: - http_msg_hdr_l1_lws: if (likely(HTTP_IS_SPHT(*ptr))) { /* replace HT,CR,LF with spaces */ for (; start + sov < ptr; sov++) @@ -1079,7 +1058,6 @@ int h1_headers_to_hdr_list(char *start, const char *stop, state = HTTP_MSG_HDR_VAL; goto http_msg_ood; } - http_msg_hdr_val2: if (likely(!HTTP_IS_CRLF(*ptr))) EAT_AND_JUMP_OR_RETURN(ptr, end, http_msg_hdr_val2, http_msg_ood, state, HTTP_MSG_HDR_VAL); @@ -1098,7 +1076,6 @@ int h1_headers_to_hdr_list(char *start, const char *stop, EAT_AND_JUMP_OR_RETURN(ptr, end, http_msg_hdr_l2_lws, http_msg_ood, state, HTTP_MSG_HDR_L2_LWS); case HTTP_MSG_HDR_L2_LWS: - http_msg_hdr_l2_lws: if (unlikely(HTTP_IS_SPHT(*ptr))) { /* LWS: replace HT,CR,LF with spaces */ for (; start + eol < ptr; eol++) -- 2.14.3

