From: Francesco Chemolli Date: Sun, 2 Feb 2014 18:19:59 +0000 (+0100) Subject: Changed pop_back() signature to match std::vector. Marked hot methods inline X-Git-Tag: SQUID_3_5_0_1~379^2~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=38c22bafc0eb403c1d79e430ce32cc159239e715;p=thirdparty%2Fsquid.git Changed pop_back() signature to match std::vector. Marked hot methods inline --- diff --git a/src/HttpHdrRange.cc b/src/HttpHdrRange.cc index 6e1810c350..950b968ca3 100644 --- a/src/HttpHdrRange.cc +++ b/src/HttpHdrRange.cc @@ -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 &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 */ } diff --git a/src/Notes.cc b/src/Notes.cc index 4cb731347e..b35029c6b9 100644 --- a/src/Notes.cc +++ b/src/Notes.cc @@ -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 * diff --git a/src/adaptation/Service.cc b/src/adaptation/Service.cc index 33b60a8b9f..10f1e642e8 100644 --- a/src/adaptation/Service.cc +++ b/src/adaptation/Service.cc @@ -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(); + } } diff --git a/src/adaptation/icap/ServiceRep.cc b/src/adaptation/icap/ServiceRep.cc index 16b86f030b..ac295a767e 100644 --- a/src/adaptation/icap/ServiceRep.cc +++ b/src/adaptation/icap/ServiceRep.cc @@ -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; } diff --git a/src/base/Vector.h b/src/base/Vector.h index 7ef43e2689..d76b5791f7 100644 --- a/src/base/Vector.h +++ b/src/base/Vector.h @@ -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::shift() } template -E +void Vector::pop_back() { assert (size()); value_type result = items[--count]; items[count] = value_type(); - return result; } template diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 3bb3e7115c..7a5a9e81f7 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -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(); diff --git a/src/errorpage.cc b/src/errorpage.cc index d7d4c51a22..8fc1fb984f 100644 --- a/src/errorpage.cc +++ b/src/errorpage.cc @@ -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; diff --git a/src/esi/VarState.cc b/src/esi/VarState.cc index f43e5b0de2..9ac9fbb794 100644 --- a/src/esi/VarState.cc +++ b/src/esi/VarState.cc @@ -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; } diff --git a/src/fs/ufs/UFSSwapDir.cc b/src/fs/ufs/UFSSwapDir.cc index 3610212557..3f26df63e6 100644 --- a/src/fs/ufs/UFSSwapDir.cc +++ b/src/fs/ufs/UFSSwapDir.cc @@ -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();