]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Do not double-check cbdataReferenceDone() argument (#1537)
authorFrancesco Chemolli <5175948+kinkie@users.noreply.github.com>
Fri, 27 Oct 2023 16:11:34 +0000 (16:11 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Fri, 27 Oct 2023 16:11:40 +0000 (16:11 +0000)
cbdataReferenceDone internally checks that the argument is not null.
Remove duplicate check from all callsites that have it

src/StoreIOState.cc
src/client_side.cc
src/client_side_request.cc
src/esi/Assign.cc
src/esi/Esi.cc
src/fs/rock/RockIoState.cc

index 38873cd7ec217dd2c8ff4525a773e734adfd29f1..3b77dbe51db2098a7c9c987e261fe50b4c8cf270 100644 (file)
@@ -45,11 +45,8 @@ StoreIOState::~StoreIOState()
 {
     debugs(20,3, "StoreIOState::~StoreIOState: " << this);
 
-    if (read.callback_data)
-        cbdataReferenceDone(read.callback_data);
-
-    if (callback_data)
-        cbdataReferenceDone(callback_data);
+    cbdataReferenceDone(read.callback_data);
+    cbdataReferenceDone(callback_data);
 }
 
 bool StoreIOState::touchingStoreEntry() const
index b5fd933b369dc5ebcde663a44023b9f8a355513e..c9a3a510a6e6cf68e9c92701fc2a09b441551894 100644 (file)
@@ -3918,8 +3918,7 @@ ConnStateData::unpinConnection(const bool andClose)
 {
     debugs(33, 3, pinning.serverConnection);
 
-    if (pinning.peer)
-        cbdataReferenceDone(pinning.peer);
+    cbdataReferenceDone(pinning.peer);
 
     if (Comm::IsConnOpen(pinning.serverConnection)) {
         if (pinning.closeHandler != nullptr) {
index 91a289bfc5cef282c90c9bc3c8a9bcb36402eed2..5b5b5af8086d29122246b2686b8cd0f74255f2eb 100644 (file)
@@ -105,8 +105,7 @@ ClientRequestContext::~ClientRequestContext()
      * still have one
      */
 
-    if (http)
-        cbdataReferenceDone(http);
+    cbdataReferenceDone(http);
 
     delete error;
     debugs(85,3, "ClientRequestContext destructed, this=" << this);
@@ -257,8 +256,7 @@ ClientHttpRequest::~ClientHttpRequest()
 
     delete calloutContext;
 
-    if (conn_)
-        cbdataReferenceDone(conn_);
+    cbdataReferenceDone(conn_);
 
     /* moving to the next connection is handled by the context free */
     dlinkDelete(&active, &ClientActiveRequests);
index 8fb062705e1ccb2a6011d73884779ec02439b0cf..35c09d737defbf1ca42b0c2dbc45a5e3b650858a 100644 (file)
@@ -139,8 +139,7 @@ ESIAssign::makeUsable(esiTreeParentPtr aParent, ESIVarState &aVarState) const
 void
 ESIAssign::finish()
 {
-    if (varState)
-        cbdataReferenceDone (varState);
+    cbdataReferenceDone(varState);
 
     if (parent.getRaw())
         parent = nullptr;
index fc0443872bca5b5627dd84b189223102aea0f8ae..c4e9194586c09bb4a5c47635b587fd5976e90e79 100644 (file)
@@ -2185,8 +2185,7 @@ esiWhen::~esiWhen()
 {
     safe_free (unevaluatedExpression);
 
-    if (varState)
-        cbdataReferenceDone (varState);
+    cbdataReferenceDone(varState);
 }
 
 void
index d86d6c21bceceb657e29c84d366959b443a96683..59f638c451493d42a9b9d466081649c529e2e116 100644 (file)
@@ -58,8 +58,7 @@ Rock::IoState::~IoState()
     // assert(!readableAnchor_);
     assert(shutting_down || !writeableAnchor_);
 
-    if (callback_data)
-        cbdataReferenceDone(callback_data);
+    cbdataReferenceDone(callback_data);
     theFile = nullptr;
 
     e->unlock("rock I/O");