lib: add a few DEBUGASSERT(data) to aid code analyzers

... where 'data' is assumed to always work.

Closes #14033
This commit is contained in:
Daniel Stenberg 2024-06-27 08:45:06 +02:00
parent ffe193c991
commit 9a49af5fd8
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
2 changed files with 4 additions and 1 deletions

View File

@ -662,6 +662,7 @@ static void connc_discard_conn(struct conncache *connc,
struct Curl_easy *data = last_data? last_data : connc->closure_handle;
bool done = FALSE;
DEBUGASSERT(data);
DEBUGASSERT(connc);
DEBUGASSERT(!conn->bundle);
@ -906,6 +907,7 @@ static void connc_perform(struct conncache *connc)
if(!e)
return;
DEBUGASSERT(data);
DEBUGASSERT(!connc->shutdowns.iter_locked);
DEBUGF(infof(data, "[CCACHE] perform, %zu connections being shutdown",
Curl_llist_count(&connc->shutdowns.conn_list)));

View File

@ -1010,8 +1010,9 @@ void Curl_detach_connection(struct Curl_easy *data)
* This is the only function that should assign data->conn
*/
void Curl_attach_connection(struct Curl_easy *data,
struct connectdata *conn)
struct connectdata *conn)
{
DEBUGASSERT(data);
DEBUGASSERT(!data->conn);
DEBUGASSERT(conn);
data->conn = conn;