summaryrefslogtreecommitdiff
path: root/lib/imap.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2016-03-31 15:12:22 +0200
committerDaniel Stenberg <daniel@haxx.se>2016-03-31 15:12:22 +0200
commite683182918bafbe40d4525e51f6d360bfba14bfa (patch)
treea1020b35a01129f7553c9a127fffc8973a10a8cc /lib/imap.c
parent0ee0d30a9f0450144d60ea906987d69ddb808da4 (diff)
downloadcurl-e683182918bafbe40d4525e51f6d360bfba14bfa.tar.gz
imap: remove duplicated function
The list and search response functions were identical! Merged into one now. Detected by PVS Studio. Reported-by: Alexis La Goutte
Diffstat (limited to 'lib/imap.c')
-rw-r--r--lib/imap.c36
1 files changed, 6 insertions, 30 deletions
diff --git a/lib/imap.c b/lib/imap.c
index 236a8c64f..934532de3 100644
--- a/lib/imap.c
+++ b/lib/imap.c
@@ -1020,9 +1020,10 @@ static CURLcode imap_state_login_resp(struct connectdata *conn,
return result;
}
-/* For LIST responses */
-static CURLcode imap_state_list_resp(struct connectdata *conn, int imapcode,
- imapstate instate)
+/* For LIST and SEARCH responses */
+static CURLcode imap_state_listsearch_resp(struct connectdata *conn,
+ int imapcode,
+ imapstate instate)
{
CURLcode result = CURLE_OK;
char *line = conn->data->state.buffer;
@@ -1249,31 +1250,6 @@ static CURLcode imap_state_append_final_resp(struct connectdata *conn,
return result;
}
-/* For SEARCH responses */
-static CURLcode imap_state_search_resp(struct connectdata *conn, int imapcode,
- imapstate instate)
-{
- CURLcode result = CURLE_OK;
- char *line = conn->data->state.buffer;
- size_t len = strlen(line);
-
- (void)instate; /* No use for this yet */
-
- if(imapcode == '*') {
- /* Temporarily add the LF character back and send as body to the client */
- line[len] = '\n';
- result = Curl_client_write(conn, CLIENTWRITE_BODY, line, len + 1);
- line[len] = '\0';
- }
- else if(imapcode != 'O')
- result = CURLE_QUOTE_ERROR; /* TODO: Fix error code */
- else
- /* End of DO phase */
- state(conn, IMAP_STOP);
-
- return result;
-}
-
static CURLcode imap_statemach_act(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
@@ -1327,7 +1303,7 @@ static CURLcode imap_statemach_act(struct connectdata *conn)
break;
case IMAP_LIST:
- result = imap_state_list_resp(conn, imapcode, imapc->state);
+ result = imap_state_listsearch_resp(conn, imapcode, imapc->state);
break;
case IMAP_SELECT:
@@ -1351,7 +1327,7 @@ static CURLcode imap_statemach_act(struct connectdata *conn)
break;
case IMAP_SEARCH:
- result = imap_state_search_resp(conn, imapcode, imapc->state);
+ result = imap_state_listsearch_resp(conn, imapcode, imapc->state);
break;
case IMAP_LOGOUT: