llist: add Curl_llist_append()

- use for better readability in all places where the "insert_next"
  actually performs an append to the list
- add some tests in unit1300

Closes #13336
This commit is contained in:
Stefan Eissing 2024-04-10 11:51:08 +02:00 committed by Daniel Stenberg
parent 8cee4c9238
commit c296abd42d
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
11 changed files with 79 additions and 20 deletions

View file

@ -374,8 +374,7 @@ static void sh_init(struct Curl_hash *hash, int hashsize)
*/
static void multi_addmsg(struct Curl_multi *multi, struct Curl_message *msg)
{
Curl_llist_insert_next(&multi->msglist, multi->msglist.tail, msg,
&msg->list);
Curl_llist_append(&multi->msglist, msg, &msg->list);
}
struct Curl_multi *Curl_multi_handle(int hashsize, /* socket hash */
@ -1002,8 +1001,7 @@ void Curl_attach_connection(struct Curl_easy *data,
DEBUGASSERT(!data->conn);
DEBUGASSERT(conn);
data->conn = conn;
Curl_llist_insert_next(&conn->easyq, conn->easyq.tail, data,
&data->conn_queue);
Curl_llist_append(&conn->easyq, data, &data->conn_queue);
if(conn->handler && conn->handler->attach)
conn->handler->attach(data, conn);
Curl_conn_ev_data_attach(conn, data);
@ -1996,8 +1994,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
multistate(data, MSTATE_PENDING);
/* add this handle to the list of connect-pending handles */
Curl_llist_insert_next(&multi->pending, multi->pending.tail, data,
&data->connect_queue);
Curl_llist_append(&multi->pending, data, &data->connect_queue);
/* unlink from the main list */
unlink_easy(multi, data);
result = CURLE_OK;
@ -2720,8 +2717,7 @@ statemachine_end:
multistate(data, MSTATE_MSGSENT);
/* add this handle to the list of msgsent handles */
Curl_llist_insert_next(&multi->msgsent, multi->msgsent.tail, data,
&data->connect_queue);
Curl_llist_append(&multi->msgsent, data, &data->connect_queue);
/* unlink from the main list */
unlink_easy(multi, data);
return CURLM_OK;