]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Interim: removed needless spacing and c++ guards, started fixing DelayTagged accessin...
authorFrancesco Chemolli <kinkie@squid-cache.org>
Fri, 2 Jan 2015 15:46:35 +0000 (16:46 +0100)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Fri, 2 Jan 2015 15:46:35 +0000 (16:46 +0100)
include/splay.h
src/DelayTagged.cc
src/acl/Arp.cc
src/acl/DomainData.cc
src/acl/Eui64.cc
src/acl/HttpStatus.cc
src/acl/Ip.cc
src/acl/StringData.cc
src/acl/UserData.cc

index 4f5455e6bc2eecf070cb38a52c39503d83dc1c4f..21719c3265dcac6c13690dbbd60f10ed49bffdce 100644 (file)
@@ -9,18 +9,13 @@
 #ifndef SQUID_SPLAY_H
 #define SQUID_SPLAY_H
 
-#if defined(__cplusplus)
-
 #include "fatal.h"
-
 #include <stack>
 
-
 // private class of Splay. Do not use directly
 template <class V>
 class SplayNode
 {
-
 public:
     typedef V Value;
     typedef int SPLAYCMP(Value const &a, Value const &b);
@@ -60,7 +55,6 @@ class SplayIterator;
 template <class V>
 class Splay
 {
-
 public:
     typedef V Value;
     typedef int SPLAYCMP(Value const &a, Value const &b);
@@ -69,7 +63,6 @@ public:
     typedef const SplayConstIterator<V> const_iterator;
     Splay():head(NULL), elements (0) {}
 
-    mutable SplayNode<V> * head;
     template <class FindValue> Value const *find (FindValue const &, int( * compare)(FindValue const &a, Value const &b)) const;
 
     void insert(Value const &, SPLAYCMP *compare);
@@ -94,6 +87,8 @@ public:
     template <class Visitor> void visit(Visitor &v) const;
 
     size_t elements;
+private:
+    mutable SplayNode<V> * head;
 };
 
 SQUIDCEXTERN int splayLastResult;
@@ -492,7 +487,5 @@ SplayConstIterator<V>::operator * () const
     return toVisit.top()->data;
 }
 
-#endif /* cplusplus */
-
 #endif /* SQUID_SPLAY_H */
 
index 7d1c764dccbf17a6d101f25f3b4d63c3dcd662e9..4d01d1c48a34d027b54a3156d8e5f2c450628157 100644 (file)
@@ -40,7 +40,7 @@ static Splay<DelayTaggedBucket::Pointer>::SPLAYFREE DelayTaggedFree;
 DelayTagged::~DelayTagged()
 {
     DelayPools::deregisterForUpdates (this);
-    buckets.head->destroy (DelayTaggedFree);
+    buckets->destroy (DelayTaggedFree);
 }
 
 static Splay<DelayTaggedBucket::Pointer>::SPLAYCMP DelayTaggedCmp;
@@ -56,11 +56,13 @@ void
 DelayTaggedFree(DelayTaggedBucket::Pointer &)
 {}
 
-void
-DelayTaggedStatsWalkee(DelayTaggedBucket::Pointer const &current, void *state)
-{
-    current->stats ((StoreEntry *)state);
-}
+struct DelayTaggedStatsVisitor {
+    StoreEntry *sentry;
+    explicit DelayTaggedStatsVisitor(StoreEntry *se) sentry(se) {}
+    void operator() (DelayTaggedBucket::Pointer const &current) {
+        current->stats(sentry);
+    }
+};
 
 void
 DelayTagged::stats(StoreEntry * sentry)
@@ -72,12 +74,13 @@ DelayTagged::stats(StoreEntry * sentry)
 
     storeAppendPrintf(sentry, "\t\tCurrent: ");
 
-    if (!buckets.head) {
+    if (buckets.empty()) {
         storeAppendPrintf (sentry, "Not used yet.\n\n");
         return;
     }
 
-    buckets.head->walk(DelayTaggedStatsWalkee, sentry);
+    DelayTaggedStatsVisitor visitor(sentry);
+    buckets.visit(visitor);
     storeAppendPrintf(sentry, "\n\n");
 }
 
index 0d5520b1549aa4b8ed39f180124f0831cbb7da85..5eae6100b432d78ad9ccd9e37f5de87599c8785c 100644 (file)
@@ -41,8 +41,10 @@ ACLARP::ACLARP (ACLARP const & old) : data (NULL), class_ (old.class_)
 
 ACLARP::~ACLARP()
 {
-    if (data)
+    if (data) {
         data->destroy();
+        delete data;
+    }
 }
 
 char const *
index 13b23d3df01e73d57acfe2f05116422115b46a80..733bd1b15def0ad269e84fb322d8b392eda841b7 100644 (file)
@@ -25,8 +25,10 @@ xRefFree(T &thing)
 
 ACLDomainData::~ACLDomainData()
 {
-    if (domains)
+    if (domains) {
         domains->destroy(xRefFree);
+        delete domains;
+    }
 }
 
 template<class T>
index 678d9d228e8a59e6cb431f4302d22e3528efffc4..d18e73a4fe8e3786c57d5bce01edb89e644a08c7 100644 (file)
@@ -41,8 +41,10 @@ ACLEui64::ACLEui64 (ACLEui64 const & old) : data (NULL), class_ (old.class_)
 
 ACLEui64::~ACLEui64()
 {
-    if (data)
+    if (data) {
         data->destroy();
+        delete data;
+    }
 }
 
 char const *
index b55ef528d2f4852d0e4f75700d804060dd4a7e2f..d83d7de4dc348ff5122d08b8ec9663b9c0bfc47f 100644 (file)
@@ -74,8 +74,10 @@ ACLHTTPStatus::ACLHTTPStatus (ACLHTTPStatus const & old) : data(NULL), class_ (o
 
 ACLHTTPStatus::~ACLHTTPStatus()
 {
-    if (data)
+    if (data) {
         data->destroy();
+        delete data;
+    }
 }
 
 char const *
index 22484d9b8cb1f5642f7b5477300b8dcbe9d4d0c2..7fc37a9b5b734632b781e66bfa797bfaf73b03dc 100644 (file)
@@ -493,8 +493,10 @@ ACLIP::parse()
 
 ACLIP::~ACLIP()
 {
-    if (data)
+    if (data) {
         data->destroy();
+        delete data;
+    }
 }
 
 struct IpAclDumpVisitor {
index 778f951aadc919f2832bf2e2354b13fe277f02d2..7775b7cfd9069ed423229465d2572fd229e0d729 100644 (file)
@@ -31,8 +31,10 @@ xRefFree(T &thing)
 
 ACLStringData::~ACLStringData()
 {
-    if (values)
+    if (values) {
         values->destroy(xRefFree);
+        delete values;
+    }
 }
 
 static int
index 638f05e72b87df1230add4faa1934a3992b42f4d..c27a37ade1817be864e747b25fe24197f1ca51a0 100644 (file)
@@ -24,8 +24,10 @@ xRefFree(T &thing)
 
 ACLUserData::~ACLUserData()
 {
-    if (names)
+    if (names) {
         names->destroy(xRefFree);
+        delete names;
+    }
 }
 
 static int