]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
NoNewGlobals for Comm::AcceptLimiter::Instance_ (#1954)
authorFrancesco Chemolli <5175948+kinkie@users.noreply.github.com>
Sun, 1 Dec 2024 11:34:00 +0000 (11:34 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Sun, 1 Dec 2024 11:34:12 +0000 (11:34 +0000)
Inspired by Coverity. CID 1441988: Useless call (USELESS_CALL).

src/comm.cc
src/comm/AcceptLimiter.cc
src/comm/AcceptLimiter.h

index 24fe6ce462c6d0ac63a890131c662084d1d57f2a..c5f4751bc78103023c9471f9afb3fd529133bbad 100644 (file)
@@ -1154,9 +1154,6 @@ comm_init(void)
 {
     assert(fd_table);
 
-    /* make sure the accept() socket FIFO delay queue exists */
-    Comm::AcceptLimiter::Instance();
-
     // make sure the IO pending callback table exists
     Comm::CallbackTableInit();
 
index a303592b89907645091e7e07c06d31c5583c8455..6df2bd2a0586bf17f9aed6c8cca968524b185339 100644 (file)
 #include "fde.h"
 #include "globals.h"
 
-Comm::AcceptLimiter Comm::AcceptLimiter::Instance_;
-
 Comm::AcceptLimiter &
 Comm::AcceptLimiter::Instance()
 {
-    return Instance_;
+    static const auto Instance_ = new AcceptLimiter();
+    return *Instance_;
 }
 
 void
index 6f18c9a8b1cdbf2385aa90d7e7bbe958fe92eb0c..e5e1435ccc4052c0841d5eb4e00097d6f909df12 100644 (file)
@@ -43,8 +43,6 @@ public:
     void kick();
 
 private:
-    static AcceptLimiter Instance_;
-
     /** FIFO queue */
     std::deque<TcpAcceptor::Pointer> deferred_;
 };