dovecot-2.2: lib-http: Removed unnecessary for loop.

dovecot at dovecot.org dovecot at dovecot.org
Fri Jun 13 07:24:06 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/368b8af23c3f
changeset: 17484:368b8af23c3f
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Jun 13 10:22:49 2014 +0300
description:
lib-http: Removed unnecessary for loop.
Found by Coverity

diffstat:

 src/lib-http/http-transfer-chunked.c |  42 ++++++++++++++++-------------------
 1 files changed, 19 insertions(+), 23 deletions(-)

diffs (52 lines):

diff -r 03520d887a4f -r 368b8af23c3f src/lib-http/http-transfer-chunked.c
--- a/src/lib-http/http-transfer-chunked.c	Fri Jun 13 03:09:26 2014 +0300
+++ b/src/lib-http/http-transfer-chunked.c	Fri Jun 13 10:22:49 2014 +0300
@@ -212,29 +212,25 @@
 				return 0;
 			/* fall through */
 		case HTTP_CHUNKED_PARSE_STATE_EXT_VALUE_STRING:
-			for (;;) {
-				if (*tcstream->cur == '"') {
-					tcstream->cur++;
-					tcstream->state = HTTP_CHUNKED_PARSE_STATE_EXT;
-					if (tcstream->cur >= tcstream->end)
-						return 0;
-					break;
-				} else if ((ret=http_transfer_chunked_skip_qdtext(tcstream)) <= 0) {
-					if (ret < 0)
-						tcstream->error = "Invalid chunked extension value";
-					return ret;
-				} else if (*tcstream->cur == '\\') {
-					tcstream->cur++;
-					tcstream->state = HTTP_CHUNKED_PARSE_STATE_EXT_VALUE_ESCAPE;
-					if (tcstream->cur >= tcstream->end)
-						return 0;
-					break;
-				} else {
-					tcstream->error = t_strdup_printf(
-						"Invalid character %s in chunked extension value string",
-						_chr_sanitize(*tcstream->cur));
-					return -1;
-				}
+			if (*tcstream->cur == '"') {
+				tcstream->cur++;
+				tcstream->state = HTTP_CHUNKED_PARSE_STATE_EXT;
+				if (tcstream->cur >= tcstream->end)
+					return 0;
+			} else if ((ret=http_transfer_chunked_skip_qdtext(tcstream)) <= 0) {
+				if (ret < 0)
+					tcstream->error = "Invalid chunked extension value";
+				return ret;
+			} else if (*tcstream->cur == '\\') {
+				tcstream->cur++;
+				tcstream->state = HTTP_CHUNKED_PARSE_STATE_EXT_VALUE_ESCAPE;
+				if (tcstream->cur >= tcstream->end)
+					return 0;
+			} else {
+				tcstream->error = t_strdup_printf(
+					"Invalid character %s in chunked extension value string",
+					_chr_sanitize(*tcstream->cur));
+				return -1;
 			}
 			break;
 		case HTTP_CHUNKED_PARSE_STATE_EXT_VALUE_ESCAPE:


More information about the dovecot-cvs mailing list