1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00

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
This commit is contained in:
Daniel Stenberg 2016-03-31 15:12:22 +02:00
parent 0ee0d30a9f
commit e683182918

View File

@ -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: