lib: skip Curl_llist_destroy calls
Linked lists themselves do not carry any allocations, so for the lists that do not have have a set destructor we can just skip the Curl_llist_destroy() call and save CPU time. Closes #10764
This commit is contained in:
parent
5ec15ea48f
commit
e5e8815532
@ -45,13 +45,6 @@
|
|||||||
|
|
||||||
#define HASHKEY_SIZE 128
|
#define HASHKEY_SIZE 128
|
||||||
|
|
||||||
static void conn_llist_dtor(void *user, void *element)
|
|
||||||
{
|
|
||||||
struct connectdata *conn = element;
|
|
||||||
(void)user;
|
|
||||||
conn->bundle = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static CURLcode bundle_create(struct connectbundle **bundlep)
|
static CURLcode bundle_create(struct connectbundle **bundlep)
|
||||||
{
|
{
|
||||||
DEBUGASSERT(*bundlep == NULL);
|
DEBUGASSERT(*bundlep == NULL);
|
||||||
@ -62,17 +55,12 @@ static CURLcode bundle_create(struct connectbundle **bundlep)
|
|||||||
(*bundlep)->num_connections = 0;
|
(*bundlep)->num_connections = 0;
|
||||||
(*bundlep)->multiuse = BUNDLE_UNKNOWN;
|
(*bundlep)->multiuse = BUNDLE_UNKNOWN;
|
||||||
|
|
||||||
Curl_llist_init(&(*bundlep)->conn_list, (Curl_llist_dtor) conn_llist_dtor);
|
Curl_llist_init(&(*bundlep)->conn_list, NULL);
|
||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bundle_destroy(struct connectbundle *bundle)
|
static void bundle_destroy(struct connectbundle *bundle)
|
||||||
{
|
{
|
||||||
if(!bundle)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Curl_llist_destroy(&bundle->conn_list, NULL);
|
|
||||||
|
|
||||||
free(bundle);
|
free(bundle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
10
lib/multi.c
10
lib/multi.c
@ -445,9 +445,6 @@ struct Curl_multi *Curl_multi_handle(int hashsize, /* socket hash */
|
|||||||
sockhash_destroy(&multi->sockhash);
|
sockhash_destroy(&multi->sockhash);
|
||||||
Curl_hash_destroy(&multi->hostcache);
|
Curl_hash_destroy(&multi->hostcache);
|
||||||
Curl_conncache_destroy(&multi->conn_cache);
|
Curl_conncache_destroy(&multi->conn_cache);
|
||||||
Curl_llist_destroy(&multi->msglist, NULL);
|
|
||||||
Curl_llist_destroy(&multi->pending, NULL);
|
|
||||||
|
|
||||||
free(multi);
|
free(multi);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -841,10 +838,6 @@ CURLMcode curl_multi_remove_handle(struct Curl_multi *multi,
|
|||||||
|
|
||||||
Curl_wildcard_dtor(&data->wildcard);
|
Curl_wildcard_dtor(&data->wildcard);
|
||||||
|
|
||||||
/* destroy the timeout list that is held in the easy handle, do this *after*
|
|
||||||
multi_done() as that may actually call Curl_expire that uses this */
|
|
||||||
Curl_llist_destroy(&data->state.timeoutlist, 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 = MSTATE_COMPLETED;
|
data->mstate = MSTATE_COMPLETED;
|
||||||
@ -2795,9 +2788,6 @@ CURLMcode curl_multi_cleanup(struct Curl_multi *multi)
|
|||||||
|
|
||||||
sockhash_destroy(&multi->sockhash);
|
sockhash_destroy(&multi->sockhash);
|
||||||
Curl_conncache_destroy(&multi->conn_cache);
|
Curl_conncache_destroy(&multi->conn_cache);
|
||||||
Curl_llist_destroy(&multi->msglist, NULL);
|
|
||||||
Curl_llist_destroy(&multi->pending, NULL);
|
|
||||||
|
|
||||||
Curl_hash_destroy(&multi->hostcache);
|
Curl_hash_destroy(&multi->hostcache);
|
||||||
Curl_psl_destroy(&multi->psl);
|
Curl_psl_destroy(&multi->psl);
|
||||||
|
|
||||||
|
|||||||
@ -727,8 +727,6 @@ static void conn_free(struct Curl_easy *data, struct connectdata *conn)
|
|||||||
Curl_safefree(conn->conn_to_host.rawalloc); /* host name buffer */
|
Curl_safefree(conn->conn_to_host.rawalloc); /* host name buffer */
|
||||||
Curl_safefree(conn->hostname_resolve);
|
Curl_safefree(conn->hostname_resolve);
|
||||||
Curl_safefree(conn->secondaryhostname);
|
Curl_safefree(conn->secondaryhostname);
|
||||||
|
|
||||||
Curl_llist_destroy(&conn->easyq, NULL);
|
|
||||||
Curl_safefree(conn->localdev);
|
Curl_safefree(conn->localdev);
|
||||||
Curl_free_primary_ssl_config(&conn->ssl_config);
|
Curl_free_primary_ssl_config(&conn->ssl_config);
|
||||||
|
|
||||||
@ -1596,7 +1594,6 @@ static struct connectdata *allocate_conn(struct Curl_easy *data)
|
|||||||
return conn;
|
return conn;
|
||||||
error:
|
error:
|
||||||
|
|
||||||
Curl_llist_destroy(&conn->easyq, NULL);
|
|
||||||
free(conn->localdev);
|
free(conn->localdev);
|
||||||
free(conn);
|
free(conn);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user