]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
lib: add a few DEBUGASSERT(data) to aid code analyzers
authorDaniel Stenberg <daniel@haxx.se>
Thu, 27 Jun 2024 06:45:06 +0000 (08:45 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 27 Jun 2024 08:31:13 +0000 (10:31 +0200)
... where 'data' is assumed to always work.

Closes #14033

lib/conncache.c
lib/multi.c

index cc9765742bbed7ad75e87625479f8cbd288f83d5..95042abe42cfb8dbf0f2ec5bac4750ea403cd497 100644 (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)));
index d510e43bc3dfbc9b50929e2c7969ea00b73f8c44..2139565189520ecfa4a561cf1b19433186e59d50 100644 (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;