Mercurial > dovecot > core-2.2
changeset 19832:5776b68902a8
doveadm: Code cleanup - remove duplicate code
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Mon, 22 Feb 2016 22:23:08 +0200 |
parents | 1b79ff2f108b |
children | 257e12f94693 |
files | src/doveadm/client-connection-http.c |
diffstat | 1 files changed, 6 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/src/doveadm/client-connection-http.c Mon Feb 22 22:10:42 2016 +0200 +++ b/src/doveadm/client-connection-http.c Mon Feb 22 22:23:08 2016 +0200 @@ -206,24 +206,21 @@ rc = doveadm_http_server_istream_read(conn); if (rc != 1) return rc; conn->json_state = JSON_STATE_COMMAND_PARAMETER_KEY; - return json_parse_next(conn->json_parser, type, value); } else if (conn->json_state == JSON_STATE_COMMAND_PARAMETER_VALUE_ARRAY) { /* reading through parameters in an array */ while ((rc = json_parse_next(conn->json_parser, type, value)) > 0) { - if (*type == JSON_TYPE_ARRAY_END) { - conn->json_state = JSON_STATE_COMMAND_PARAMETER_KEY; - return json_parse_next(conn->json_parser, type, value); - } + if (*type == JSON_TYPE_ARRAY_END) + break; if (*type != JSON_TYPE_STRING) return -2; tmp = p_strdup(conn->client.pool,*value); array_append(&conn->cmd_param->value.v_array, &tmp, 1); } - return rc; + if (rc <= 0) + return rc; + conn->json_state = JSON_STATE_COMMAND_PARAMETER_KEY; } else if (conn->json_state == JSON_STATE_COMMAND_PARAMETER_VALUE) { if (conn->cmd_param->type == CMD_PARAM_ISTREAM) { - if (conn->cmd_param->value_set == TRUE) - return json_parse_next(conn->json_parser, type, value); struct istream* is[2] = {0}; rc = json_parse_next_stream(conn->json_parser, &is[0]); if (rc != 1) return rc; @@ -250,8 +247,6 @@ } tmp = p_strdup(conn->client.pool,*value); array_append(&conn->cmd_param->value.v_array, &tmp, 1); - conn->json_state = JSON_STATE_COMMAND_PARAMETER_KEY; - return json_parse_next(conn->json_parser, type, value); } else { conn->cmd_param->value_set = TRUE; switch(conn->cmd_param->type) { @@ -268,13 +263,9 @@ break; } } - rc = json_parse_next(conn->json_parser, type, value); conn->json_state = JSON_STATE_COMMAND_PARAMETER_KEY; - return rc; - } else { - rc = json_parse_next(conn->json_parser, type, value); /* just get next */ - return rc; } + return json_parse_next(conn->json_parser, type, value); /* just get next */ } static void