curl_multi_remove_handle: remove dead code

Coverify CID 1157776. Removed a superfluous if() that always evaluated
true (and an else clause that never ran), and then re-indented the
function accordingly.
This commit is contained in:
Daniel Stenberg
2014-10-03 23:46:10 +02:00
parent b9a34e818e
commit b0bfae1963

View File

@@ -487,6 +487,9 @@ CURLMcode curl_multi_remove_handle(CURLM *multi_handle,
struct Curl_multi *multi=(struct Curl_multi *)multi_handle; struct Curl_multi *multi=(struct Curl_multi *)multi_handle;
struct SessionHandle *easy = curl_handle; struct SessionHandle *easy = curl_handle;
struct SessionHandle *data = easy; struct SessionHandle *data = easy;
bool premature;
bool easy_owns_conn;
struct curl_llist_element *e;
/* First, make some basic checks that the CURLM handle is a good handle */ /* First, make some basic checks that the CURLM handle is a good handle */
if(!GOOD_MULTI_HANDLE(multi)) if(!GOOD_MULTI_HANDLE(multi))
@@ -500,10 +503,9 @@ CURLMcode curl_multi_remove_handle(CURLM *multi_handle,
if(!data->multi) if(!data->multi)
return CURLM_OK; /* it is already removed so let's say it is fine! */ return CURLM_OK; /* it is already removed so let's say it is fine! */
if(easy) {
bool premature = (data->mstate < CURLM_STATE_COMPLETED) ? TRUE : FALSE; premature = (data->mstate < CURLM_STATE_COMPLETED) ? TRUE : FALSE;
bool easy_owns_conn = (data->easy_conn && easy_owns_conn = (data->easy_conn && (data->easy_conn->data == easy)) ?
(data->easy_conn->data == easy)) ?
TRUE : FALSE; TRUE : FALSE;
/* If the 'state' is not INIT or COMPLETED, we might need to do something /* If the 'state' is not INIT or COMPLETED, we might need to do something
@@ -564,15 +566,15 @@ CURLMcode curl_multi_remove_handle(CURLM *multi_handle,
Curl_wildcard_dtor(&data->wildcard); Curl_wildcard_dtor(&data->wildcard);
/* as this was using a shared connection cache we clear the pointer /* as this was using a shared connection cache we clear the pointer to that
to that since we're not part of that multi handle anymore */ since we're not part of that multi handle anymore */
data->state.conn_cache = NULL; data->state.conn_cache = NULL;
/* change state without using multistate(), only to make singlesocket() do /* change state without using multistate(), only to make singlesocket() do
what we want */ what we want */
data->mstate = CURLM_STATE_COMPLETED; data->mstate = CURLM_STATE_COMPLETED;
singlesocket(multi, easy); /* to let the application know what sockets singlesocket(multi, easy); /* to let the application know what sockets that
that vanish with this handle */ vanish with this handle */
/* Remove the association between the connection and the handle */ /* Remove the association between the connection and the handle */
if(data->easy_conn) { if(data->easy_conn) {
@@ -582,10 +584,8 @@ CURLMcode curl_multi_remove_handle(CURLM *multi_handle,
data->multi = NULL; /* clear the association to this multi handle */ data->multi = NULL; /* clear the association to this multi handle */
{
/* make sure there's no pending message in the queue sent from this easy /* make sure there's no pending message in the queue sent from this easy
handle */ handle */
struct curl_llist_element *e;
for(e = multi->msglist->head; e; e = e->next) { for(e = multi->msglist->head; e; e = e->next) {
struct Curl_message *msg = e->ptr; struct Curl_message *msg = e->ptr;
@@ -596,7 +596,6 @@ CURLMcode curl_multi_remove_handle(CURLM *multi_handle,
break; break;
} }
} }
}
/* make the previous node point to our next */ /* make the previous node point to our next */
if(data->prev) if(data->prev)
@@ -612,15 +611,11 @@ CURLMcode curl_multi_remove_handle(CURLM *multi_handle,
/* NOTE NOTE NOTE /* NOTE NOTE NOTE
We do not touch the easy handle here! */ We do not touch the easy handle here! */
multi->num_easy--; /* one less to care about now */ multi->num_easy--; /* one less to care about now */
update_timer(multi); update_timer(multi);
return CURLM_OK; return CURLM_OK;
} }
else
return CURLM_BAD_EASY_HANDLE; /* twasn't found */
}
bool Curl_multi_pipeline_enabled(const struct Curl_multi *multi) bool Curl_multi_pipeline_enabled(const struct Curl_multi *multi)
{ {