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
1 changed files with 110 additions and 115 deletions

View File

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