]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Changed pop_back() signature to match std::vector. Marked hot methods inline
authorFrancesco Chemolli <kinkie@squid-cache.org>
Sun, 2 Feb 2014 18:19:59 +0000 (19:19 +0100)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Sun, 2 Feb 2014 18:19:59 +0000 (19:19 +0100)
src/HttpHdrRange.cc
src/Notes.cc
src/adaptation/Service.cc
src/adaptation/icap/ServiceRep.cc
src/base/Vector.h
src/cache_cf.cc
src/errorpage.cc
src/esi/VarState.cc
src/fs/ufs/UFSSwapDir.cc

index 6e1810c3508679cf1236cc826e998da7cccc5262..950b968ca338e47a59ec1235d08ca44102cd238a 100644 (file)
@@ -266,8 +266,10 @@ HttpHdrRange::parseInit(const String * range_spec)
          * at least one syntactically invalid byte-range-specs.
          */
         if (!spec) {
-            while (!specs.empty())
-                delete specs.pop_back();
+            while (!specs.empty()) {
+                delete specs.back();
+                specs.pop_back();
+            }
             debugs(64, 2, "ignoring invalid range field: '" << range_spec << "'");
             break;
         }
@@ -281,8 +283,10 @@ HttpHdrRange::parseInit(const String * range_spec)
 
 HttpHdrRange::~HttpHdrRange()
 {
-    while (specs.size())
-        delete specs.pop_back();
+    while (specs.size()) {
+        delete specs.back();
+        specs.pop_back();
+    }
 }
 
 HttpHdrRange::HttpHdrRange(HttpHdrRange const &old) :
@@ -350,7 +354,8 @@ HttpHdrRange::merge (Vector<HttpHdrRangeSpec *> &basis)
     while (i != basis.end()) {
         if (specs.size() && (*i)->mergeWith(specs.back())) {
             /* merged with current so get rid of the prev one */
-            delete specs.pop_back();
+            delete specs.back();
+            specs.pop_back();
             continue;  /* re-iterate */
         }
 
index 4cb731347eb56f2aff8323b3fcc0cdf7492fd723..b35029c6b99303f39bd2a54288a8d0f6b1e6bbc1 100644 (file)
@@ -151,8 +151,10 @@ Notes::clean()
 
 NotePairs::~NotePairs()
 {
-    while (!entries.empty())
-        delete entries.pop_back();
+    while (!entries.empty()) {
+        delete entries.back();
+        entries.pop_back();
+    }
 }
 
 const char *
index 33b60a8b9f70c176d3bddb65a61006391e1d888d..10f1e642e81c54e9d14a8e00fbcc73eb29057c81 100644 (file)
@@ -71,6 +71,8 @@ Adaptation::FindService(const Service::Id& key)
 
 void Adaptation::DetachServices()
 {
-    while (!AllServices().empty())
-        AllServices().pop_back()->detach();
+    while (!AllServices().empty()) {
+        AllServices().back()->detach();
+        AllServices().pop_back();
+    }
 }
index 16b86f030bdfec46586101f914001c8db82e68c4..ac295a767e916a0191652b98d7fdd2b725dd060f 100644 (file)
@@ -375,7 +375,8 @@ void Adaptation::Icap::ServiceRep::noteTimeToNotify()
     Pointer us = NULL;
 
     while (!theClients.empty()) {
-        Client i = theClients.pop_back();
+        Client i = theClients.back();
+        theClients.pop_back();
         ScheduleCallHere(i.callback);
         i.callback = 0;
     }
index 7ef43e2689a384a2a233aac290b49e3922415bd7..d76b5791f7f7154fe52f5c605a44d37479eac069 100644 (file)
@@ -106,20 +106,20 @@ public:
     const E &front() const;
     E &front();
     E &back();
-    E pop_back();
+    void pop_back();
     E shift();         // aka pop_front
     void prune(E);
     void preAppend(int app_count);
-    bool empty() const;
-    size_t size() const;
+    inline bool empty() const;
+    inline size_t size() const;
     iterator begin();
     const_iterator begin () const;
     iterator end();
     const_iterator end () const;
     E& at(unsigned i);
     const E& at(unsigned i) const;
-    E& operator [] (unsigned i);
-    const E& operator [] (unsigned i) const;
+    inline E& operator [] (unsigned i);
+    inline const E& operator [] (unsigned i) const;
     E* data() const { return items; }
 
 protected:
@@ -244,13 +244,12 @@ Vector<E>::shift()
 }
 
 template<class E>
-E
+void
 Vector<E>::pop_back()
 {
     assert (size());
     value_type result = items[--count];
     items[count] = value_type();
-    return result;
 }
 
 template<class E>
index 3bb3e7115cb398fa2496d0c93a6efe099e8674a0..7a5a9e81f7af7cee59c0c75d6c1a344b7b6ce483 100644 (file)
@@ -1873,11 +1873,6 @@ free_authparam(Auth::ConfigVector * cfg)
     /* Wipe the Auth globals and Detach/Destruct component config + state. */
     cfg->clear();
 
-    /* remove our pointers to the probably-dead sub-configs */
-    while (cfg->size()) {
-        cfg->pop_back();
-    }
-
     /* on reconfigure initialize new auth schemes for the new config. */
     if (reconfiguring) {
         Auth::Init();
index d7d4c51a22c87e6a2230e6d545ed4e8fcab8e405..8fc1fb984fc41251db609147db150beed24b9c65 100644 (file)
@@ -247,8 +247,10 @@ errorClean(void)
         safe_free(error_text);
     }
 
-    while (ErrorDynamicPages.size())
-        errorDynamicPageInfoDestroy(ErrorDynamicPages.pop_back());
+    while (ErrorDynamicPages.size()) {
+        errorDynamicPageInfoDestroy(ErrorDynamicPages.back());
+        ErrorDynamicPages.pop_back();
+    }
 
     error_page_count = 0;
 
index f43e5b0de2b5693ba9057bbf240e03e1bc3b1dfb..9ac9fbb7947f78b0e084e8e483a0c6bee93c279b 100644 (file)
@@ -167,8 +167,10 @@ ESIVarState::~ESIVarState()
 {
     freeResources();
 
-    while (variablesForCleanup.size())
-        delete variablesForCleanup.pop_back();
+    while (variablesForCleanup.size()) {
+        delete variablesForCleanup.back();
+        variablesForCleanup.pop_back();
+    }
 
     delete defaultVariable;
 }
index 3610212557da8f6945489a37e5c2c3c4faedcbf5..3f26df63e69e71773143dcdf1e4a816e6ed4651e 100644 (file)
@@ -230,8 +230,10 @@ Fs::Ufs::UFSSwapDir::changeIO(DiskIOModule *module)
     IO->io = anIO;
     /* Change the IO Options */
 
-    if (currentIOOptions && currentIOOptions->options.size() > 2)
-        delete currentIOOptions->options.pop_back();
+    if (currentIOOptions && currentIOOptions->options.size() > 2) {
+        delete currentIOOptions->options.back();
+        currentIOOptions->options.pop_back();
+    }
 
     /* TODO: factor out these 4 lines */
     ConfigOption *ioOptions = IO->io->getOptionTree();