]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Undo trunk r13266: "vector-refactor branch: align Vector API with std::vector"
authorAlex Rousskov <rousskov@measurement-factory.com>
Tue, 18 Mar 2014 00:51:48 +0000 (18:51 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Tue, 18 Mar 2014 00:51:48 +0000 (18:51 -0600)
to avoid stability issues related to std::vector migration.

32 files changed:
lib/MemPoolMalloc.cc
src/ClientDelayConfig.cc
src/ConfigOption.cc
src/DiskIO/DiskIOModule.cc
src/ExternalACLEntry.cc
src/FwdState.cc
src/HttpHdrRange.cc
src/HttpHeader.cc
src/HttpRequest.cc
src/Notes.cc
src/Notes.h
src/StoreFileSystem.cc
src/adaptation/AccessCheck.cc
src/adaptation/Config.cc
src/adaptation/DynamicGroupCfg.cc
src/adaptation/Service.cc
src/adaptation/ServiceGroups.cc
src/adaptation/icap/Options.cc
src/adaptation/icap/ServiceRep.cc
src/auth/Gadgets.cc
src/base/Vector.h
src/cache_cf.cc
src/client_side.cc
src/errorpage.cc
src/esi/CustomParser.cc
src/esi/VarState.cc
src/fs/ufs/UFSSwapDir.cc
src/ipc/Kids.cc
src/store.cc
src/store_dir.cc
src/tests/test_http_range.cc
src/tunnel.cc

index 5a442f4e2060c568ad38b36f8891f7c90225d3ab..4e25cc420786b29380c5f557a6f350634a388cfe 100644 (file)
@@ -122,7 +122,7 @@ MemPoolMalloc::~MemPoolMalloc()
 bool
 MemPoolMalloc::idleTrigger(int shift) const
 {
-    return freelist.size() >> (shift ? 8 : 0);
+    return freelist.count >> (shift ? 8 : 0);
 }
 
 void
index a588fd4aeaea08f314626b304ca769ee66663c1b..0d95212f786ec722576c39bf3035286303eeda83 100644 (file)
@@ -30,7 +30,7 @@ ClientDelayConfig::finalize()
 
 void ClientDelayConfig::freePoolCount()
 {
-    pools.clear();
+    pools.clean();
 }
 
 void ClientDelayConfig::dumpPoolCount(StoreEntry * entry, const char *name) const
index 2b771479ee8abac07e48cfef351587babb5a9c37..92a5ede6afb855edc63b07cf3b171d7ab95ecaae 100644 (file)
@@ -35,7 +35,7 @@
 
 ConfigOptionVector::~ConfigOptionVector()
 {
-    while (!options.empty()) {
+    while (options.size()) {
         delete options.back();
         options.pop_back();
     }
index 2992f2237dd0f0acebebc6563fd052481c110a97..0bc3278ac086a15dd19596b5251c360b81b0d805 100644 (file)
@@ -92,7 +92,7 @@ DiskIOModule::GetModules()
 void
 DiskIOModule::FreeAllModules()
 {
-    while (!GetModules().empty()) {
+    while (GetModules().size()) {
         DiskIOModule *fs = GetModules().back();
         GetModules().pop_back();
         fs->gracefulShutdown();
index 6e3a969e1647eaaa736462257af61d051eaecdc1..a8a459cd079624fc6ae575c6a7ce612e28cf6998 100644 (file)
@@ -70,7 +70,7 @@ ExternalACLEntry::update(ExternalACLEntryData const &someData)
     result = someData.result;
 
     // replace all notes. not combine
-    notes.entries.clear();
+    notes.entries.clean();
     notes.append(&someData.notes);
 
 #if USE_AUTH
index 881cb94dad15ab2e855c3cd1a5d39530ee53c830..6847fed133923852177ff5c66f2836dc691baf19 100644 (file)
@@ -112,7 +112,7 @@ FwdState::abort(void* d)
     } else {
         debugs(17, 7, HERE << "store entry aborted; no connection to close");
     }
-    fwd->serverDestinations.clear();
+    fwd->serverDestinations.clean();
     fwd->self = NULL;
 }
 
@@ -277,7 +277,7 @@ FwdState::~FwdState()
         serverConn->close();
     }
 
-    serverDestinations.clear();
+    serverDestinations.clean();
 
     debugs(17, 3, HERE << "FwdState destructor done");
 }
index 32d71f1fcf250e9e7d2fca5244525494737e4bcd..bea0c7a42c1ba4765deaa918f445a92bbb676122 100644 (file)
@@ -266,10 +266,8 @@ HttpHdrRange::parseInit(const String * range_spec)
          * at least one syntactically invalid byte-range-specs.
          */
         if (!spec) {
-            while (!specs.empty()) {
-                delete specs.back();
-                specs.pop_back();
-            }
+            while (!specs.empty())
+                delete specs.pop_back();
             debugs(64, 2, "ignoring invalid range field: '" << range_spec << "'");
             break;
         }
@@ -283,10 +281,8 @@ HttpHdrRange::parseInit(const String * range_spec)
 
 HttpHdrRange::~HttpHdrRange()
 {
-    while (!specs.empty()) {
-        delete specs.back();
-        specs.pop_back();
-    }
+    while (specs.size())
+        delete specs.pop_back();
 }
 
 HttpHdrRange::HttpHdrRange(HttpHdrRange const &old) :
@@ -345,7 +341,7 @@ void
 HttpHdrRange::merge (Vector<HttpHdrRangeSpec *> &basis)
 {
     /* reset old array */
-    specs.clear();
+    specs.clean();
     /* merge specs:
      * take one spec from "goods" and merge it with specs from
      * "specs" (if any) until there is no overlap */
@@ -354,8 +350,7 @@ 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.back();
-            specs.pop_back();
+            delete specs.pop_back();
             continue;  /* re-iterate */
         }
 
@@ -409,14 +404,14 @@ int
 HttpHdrRange::canonize (int64_t newClen)
 {
     clen = newClen;
-    debugs(64, 3, "HttpHdrRange::canonize: started with " << specs.size() <<
+    debugs(64, 3, "HttpHdrRange::canonize: started with " << specs.count <<
            " specs, clen: " << clen);
     Vector<HttpHdrRangeSpec*> goods;
     getCanonizedSpecs(goods);
     merge (goods);
-    debugs(64, 3, "HttpHdrRange::canonize: finished with " << specs.size() <<
+    debugs(64, 3, "HttpHdrRange::canonize: finished with " << specs.count <<
            " specs");
-    return specs.size() > 0; // fixme, should return bool
+    return specs.count > 0;
 }
 
 /* hack: returns true if range specs are too "complex" for Squid to handle */
index f0f3e454ea8d25bbaa1dd7fdc72ec88be583b838..bd6c0eb08e08f7d59897f18780710e8142fff870 100644 (file)
@@ -454,12 +454,12 @@ HttpHeader::clean()
          * has been used.  As a hack, just never count zero-sized header
          * arrays.
          */
-        if (!entries.empty())
-            HttpHeaderStats[owner].hdrUCountDistr.count(entries.size());
+        if (0 != entries.count)
+            HttpHeaderStats[owner].hdrUCountDistr.count(entries.count);
 
         ++ HttpHeaderStats[owner].destroyedCount;
 
-        HttpHeaderStats[owner].busyDestroyedCount += entries.size() > 0;
+        HttpHeaderStats[owner].busyDestroyedCount += entries.count > 0;
     } // if (owner <= hoReply)
 
     while ((e = getEntry(&pos))) {
@@ -474,7 +474,7 @@ HttpHeader::clean()
             delete e;
         }
     }
-    entries.clear();
+    entries.clean();
     httpHeaderMaskInit(&mask, 0);
     len = 0;
     PROF_stop(HttpHeaderClean);
@@ -748,11 +748,11 @@ HttpHeaderEntry *
 HttpHeader::getEntry(HttpHeaderPos * pos) const
 {
     assert(pos);
-    assert(*pos >= HttpHeaderInitPos && *pos < static_cast<ssize_t>(entries.size()));
+    assert(*pos >= HttpHeaderInitPos && *pos < (ssize_t)entries.count);
 
-    for (++(*pos); *pos < static_cast<ssize_t>(entries.size()); ++(*pos)) {
-        if (entries[*pos])
-            return static_cast<HttpHeaderEntry*>(entries[*pos]);
+    for (++(*pos); *pos < (ssize_t)entries.count; ++(*pos)) {
+        if (entries.items[*pos])
+            return (HttpHeaderEntry*)entries.items[*pos];
     }
 
     return NULL;
@@ -871,9 +871,9 @@ void
 HttpHeader::delAt(HttpHeaderPos pos, int &headers_deleted)
 {
     HttpHeaderEntry *e;
-    assert(pos >= HttpHeaderInitPos && pos < static_cast<ssize_t>(entries.size()));
-    e = static_cast<HttpHeaderEntry*>(entries[pos]);
-    entries[pos] = NULL;
+    assert(pos >= HttpHeaderInitPos && pos < (ssize_t)entries.count);
+    e = (HttpHeaderEntry*)entries.items[pos];
+    entries.items[pos] = NULL;
     /* decrement header length, allow for ": " and crlf */
     len -= e->name.size() + 2 + e->value.size() + 2;
     assert(len >= 0);
@@ -914,7 +914,7 @@ HttpHeader::addEntry(HttpHeaderEntry * e)
     assert_eid(e->id);
     assert(e->name.size());
 
-    debugs(55, 7, this << " adding entry: " << e->id << " at " << entries.size());
+    debugs(55, 7, HERE << this << " adding entry: " << e->id << " at " << entries.count);
 
     if (CBIT_TEST(mask, e->id))
         ++ Headers[e->id].stat.repCount;
@@ -936,7 +936,7 @@ HttpHeader::insertEntry(HttpHeaderEntry * e)
     assert(e);
     assert_eid(e->id);
 
-    debugs(55, 7, this << " adding entry: " << e->id << " at " << entries.size());
+    debugs(55, 7, HERE << this << " adding entry: " << e->id << " at " << entries.count);
 
     if (CBIT_TEST(mask, e->id))
         ++ Headers[e->id].stat.repCount;
index 764e71f90950dae7cd924819c642a8ea6a90a879..d43b23df469819902f82442ca7c50e847b2b3e72 100644 (file)
@@ -479,7 +479,7 @@ HttpRequest::adaptHistoryImport(const HttpRequest &them)
 bool
 HttpRequest::multipartRangeRequest() const
 {
-    return (range && range->specs.size() > 1);
+    return (range && range->specs.count > 1);
 }
 
 bool
index b35029c6b99303f39bd2a54288a8d0f6b1e6bbc1..ad84e0ea6bff4af1ac28851f77e30cfabdd446dc 100644 (file)
@@ -146,15 +146,13 @@ Notes::dump(StoreEntry *entry, const char *key)
 void
 Notes::clean()
 {
-    notes.clear();
+    notes.clean();
 }
 
 NotePairs::~NotePairs()
 {
-    while (!entries.empty()) {
-        delete entries.back();
-        entries.pop_back();
-    }
+    while (!entries.empty())
+        delete entries.pop_back();
 }
 
 const char *
index 6490f5d24e5870d4e9849b7d745a2b23cacd9588..b6c60af0095c326d508817a9b07d48f461823569 100644 (file)
@@ -74,7 +74,7 @@ public:
 
     Notes(const char *aDescr, const char **metasBlacklist, bool allowFormatted = false): descr(aDescr), blacklisted(metasBlacklist), formattedValues(allowFormatted) {}
     Notes(): descr(NULL), blacklisted(NULL) {}
-    ~Notes() { notes.clear(); }
+    ~Notes() { notes.clean(); }
     /**
      * Parse a notes line and returns a pointer to the
      * parsed Note object.
index 293c37f4e20108fc934e2e450734c0fa7efbf8d0..7b3497ed22337c93d2263fb1716fccd6c9b28d94 100644 (file)
@@ -87,7 +87,7 @@ StoreFileSystem::GetFileSystems()
 void
 StoreFileSystem::FreeAllFs()
 {
-    while (!GetFileSystems().empty()) {
+    while (GetFileSystems().size()) {
         StoreFileSystem *fs = GetFileSystems().back();
         GetFileSystems().pop_back();
         fs->done();
index 19ee86346bce58c48c7965165cd14aeb60e35464..3e50fc67c818618a272323d48e1848114a03f83e 100644 (file)
@@ -102,7 +102,7 @@ Adaptation::AccessCheck::check()
         AccessRule *r = *i;
         if (isCandidate(*r)) {
             debugs(93, 5, HERE << "check: rule '" << r->id << "' is a candidate");
-            candidates.push_back(r->id);
+            candidates += r->id;
         }
     }
 
index d133c493e61f05d32ad444d8a2b2f5ef5bf1039c..2794a4cdd22504196209cc7123ab1845c1327826 100644 (file)
@@ -139,7 +139,7 @@ Adaptation::Config::clear()
     const ServiceConfigs& configs = serviceConfigs;
     for (SCI cfg = configs.begin(); cfg != configs.end(); ++cfg)
         removeService((*cfg)->key);
-    serviceConfigs.clear();
+    serviceConfigs.clean();
     debugs(93, 3, HERE << "rules: " << AllRules().size() << ", groups: " <<
            AllGroups().size() << ", services: " << serviceConfigs.size());
 }
@@ -163,7 +163,7 @@ Adaptation::Config::freeService()
 
     DetachServices();
 
-    serviceConfigs.clear();
+    serviceConfigs.clean();
 }
 
 void
@@ -210,7 +210,7 @@ Adaptation::Config::finalize()
     debugs(93,3, HERE << "Created " << created << " adaptation services");
 
     // services remember their configs; we do not have to
-    serviceConfigs.clear();
+    serviceConfigs.clean();
     return true;
 }
 
index 5d06f78fdd89bd8c3b24056201d456e804374f8b..f5ebf4a3d779f5b348f459cdf08d4a81db2e7590 100644 (file)
@@ -18,5 +18,5 @@ void
 Adaptation::DynamicGroupCfg::clear()
 {
     id.clean();
-    services.clear();
+    services.clean();
 }
index 10f1e642e81c54e9d14a8e00fbcc73eb29057c81..33b60a8b9f70c176d3bddb65a61006391e1d888d 100644 (file)
@@ -71,8 +71,6 @@ Adaptation::FindService(const Service::Id& key)
 
 void Adaptation::DetachServices()
 {
-    while (!AllServices().empty()) {
-        AllServices().back()->detach();
-        AllServices().pop_back();
-    }
+    while (!AllServices().empty())
+        AllServices().pop_back()->detach();
 }
index 28e7d83763e20b868e9ec3f3b9a8c49b593bbdf5..ad196bc1a9a45b74fae1a68b142474ac11770856 100644 (file)
@@ -48,7 +48,7 @@ Adaptation::ServiceGroup::finalize()
         }
         s.cut(s.size() - 1);
         debugs(93, DBG_IMPORTANT, "Adaptation group '" << id << "' contains disabled member(s) after reconfiguration: " << s);
-        removedServices.clear();
+        removedServices.clean();
     }
 
     String baselineKey;
index 9524a1ec49698250e3f47eb251ebb58a17b8405a..e219a3751ca5081b14ab17d17a6fd3524915cdf4 100644 (file)
@@ -125,7 +125,7 @@ void Adaptation::Icap::Options::configure(const HttpReply *reply)
 void Adaptation::Icap::Options::cfgMethod(ICAP::Method m)
 {
     Must(m != ICAP::methodNone);
-    methods.push_back(m);
+    methods += m;
 }
 
 // TODO: HttpHeader should provide a general method for this type of conversion
index ac295a767e916a0191652b98d7fdd2b725dd060f..16b86f030bdfec46586101f914001c8db82e68c4 100644 (file)
@@ -375,8 +375,7 @@ void Adaptation::Icap::ServiceRep::noteTimeToNotify()
     Pointer us = NULL;
 
     while (!theClients.empty()) {
-        Client i = theClients.back();
-        theClients.pop_back();
+        Client i = theClients.pop_back();
         ScheduleCallHere(i.callback);
         i.callback = 0;
     }
index 03c1c2e930f423d01e452e120be7df34b2b8e066..f31c9049cd54d9daa514edc64b545e547d41cb51 100644 (file)
@@ -133,7 +133,7 @@ authenticateReset(void)
     authenticateRotate();
 
     /* free current global config details too. */
-    Auth::TheConfig.clear();
+    Auth::TheConfig.clean();
 }
 
 AuthUserHashPointer::AuthUserHashPointer(Auth::User::Pointer anAuth_user):
index 05d58f128173660f7b70be7454284be261f0925b..5f430955b03b739fae7ac18647ea3dcf4d211f32 100644 (file)
@@ -32,7 +32,7 @@
 #define SQUID_ARRAY_H
 
 /**
- \todo remove this after replacing with STL
+ \todo CLEANUP: this file should be called Vector.h at least, and probably be replaced by STL Vector<C>
  */
 
 #include "fatal.h"
@@ -88,8 +88,7 @@ public:
     typedef VectorIteratorBase<Vector<E> > iterator;
     typedef VectorIteratorBase<Vector<E> const> const_iterator;
     typedef ptrdiff_t difference_type;
-    friend class VectorIteratorBase<Vector<E> >;
-    friend class VectorIteratorBase<Vector<E> const>;
+
     void *operator new (size_t);
     void operator delete (void *);
 
@@ -97,31 +96,29 @@ public:
     ~Vector();
     Vector(Vector const &);
     Vector &operator = (Vector const &);
-    void clear();
+    void clean();
     void reserve (size_t capacity);
     void push_back (E);
+    Vector &operator += (E item) {push_back(item); return *this;};
 
     void insert (E);
     const E &front() const;
     E &front();
     E &back();
-    void pop_back();
+    E pop_back();
     E shift();         // aka pop_front
     void prune(E);
     void preAppend(int app_count);
-    inline bool empty() const;
-    inline size_t size() const;
+    bool empty() const;
+    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;
-    inline E& operator [] (unsigned i);
-    inline const E& operator [] (unsigned i) const;
-    E* data() const { return items; }
+    E& operator [] (unsigned i);
+    const E& operator [] (unsigned i) const;
 
-protected:
+    /* Do not change these, until the entry C struct is removed */
     size_t capacity;
     size_t count;
     E *items;
@@ -148,12 +145,12 @@ Vector<E>::Vector() : capacity (0), count(0), items (NULL)
 template<class E>
 Vector<E>::~Vector()
 {
-    clear();
+    clean();
 }
 
 template<class E>
 void
-Vector<E>::clear()
+Vector<E>::clean()
 {
     /* could also warn if some objects are left */
     delete[] items;
@@ -243,12 +240,13 @@ Vector<E>::shift()
 }
 
 template<class E>
-void
+E
 Vector<E>::pop_back()
 {
     assert (size());
-    --count;
+    value_type result = items[--count];
     items[count] = value_type();
+    return result;
 }
 
 template<class E>
@@ -316,7 +314,7 @@ template<class E>
 Vector<E> &
 Vector<E>::operator = (Vector<E> const &old)
 {
-    clear();
+    clean();
     reserve (old.size());
 
     for (size_t counter = 0; counter < old.size(); ++counter)
@@ -367,26 +365,11 @@ Vector<E>::end() const
     return const_iterator(size(), *this);
 }
 
-template<class E>
-E &
-Vector<E>::at(unsigned i)
-{
-    assert (size() > i);
-    return operator[](i);
-}
-
-template<class E>
-const E &
-Vector<E>::at(unsigned i) const
-{
-    assert (size() > i);
-    return operator[](i);
-}
-
 template<class E>
 E &
 Vector<E>::operator [] (unsigned i)
 {
+    assert (size() > i);
     return items[i];
 }
 
@@ -394,6 +377,7 @@ template<class E>
 const E &
 Vector<E>::operator [] (unsigned i) const
 {
+    assert (size() > i);
     return items[i];
 }
 
index 7e24e9206d5e160559b9431fb8293d4bb35f93d0..9d05a90585acd068298c0d274c2c256f716434d0 100644 (file)
@@ -1867,7 +1867,12 @@ static void
 free_authparam(Auth::ConfigVector * cfg)
 {
     /* Wipe the Auth globals and Detach/Destruct component config + state. */
-    cfg->clear();
+    cfg->clean();
+
+    /* 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) {
@@ -1888,7 +1893,7 @@ static int
 find_fstype(char *type)
 {
     for (size_t i = 0; i < StoreFileSystem::FileSystems().size(); ++i)
-        if (strcasecmp(type, StoreFileSystem::FileSystems().at(i)->type()) == 0)
+        if (strcasecmp(type, StoreFileSystem::FileSystems().items[i]->type()) == 0)
             return (int)i;
 
     return (-1);
@@ -1931,7 +1936,7 @@ parse_cachedir(SquidConfig::_cacheSwap * swap)
 
             sd = dynamic_cast<SwapDir *>(swap->swapDirs[i].getRaw());
 
-            if (strcmp(sd->type(), StoreFileSystem::FileSystems().at(fs)->type()) != 0) {
+            if (strcmp(sd->type(), StoreFileSystem::FileSystems().items[fs]->type()) != 0) {
                 debugs(3, DBG_CRITICAL, "ERROR: Can't change type of existing cache_dir " <<
                        sd->type() << " " << sd->path << " to " << type_str << ". Restart required");
                 return;
@@ -1956,7 +1961,7 @@ parse_cachedir(SquidConfig::_cacheSwap * swap)
 
     allocate_new_swapdir(swap);
 
-    swap->swapDirs[swap->n_configured] = StoreFileSystem::FileSystems().at(fs)->createSwapDir();
+    swap->swapDirs[swap->n_configured] = StoreFileSystem::FileSystems().items[fs]->createSwapDir();
 
     sd = dynamic_cast<SwapDir *>(swap->swapDirs[swap->n_configured].getRaw());
 
index df1fdb8eed417bdfaee8cb8bfc2448af6243d8dc..115393fc951895be24f35db03c97043c7df7065f 100644 (file)
@@ -1353,7 +1353,7 @@ ClientSocketContext::buildRangeHeader(HttpReply * rep)
         bool replyMatchRequest = rep->content_range != NULL ?
                                  request->range->contains(rep->content_range->spec) :
                                  true;
-        const int spec_count = http->request->range->specs.size();
+        const int spec_count = http->request->range->specs.count;
         int64_t actual_clen = -1;
 
         debugs(33, 3, "clientBuildRangeHeader: range spec count: " <<
index 942588e91c0f88a63b018acaa82ddc6de7376653..4d98ba2e1887942c0f58b73e7857d0eda4610c04 100644 (file)
@@ -204,7 +204,7 @@ errorInitialize(void)
             /** \par
              * Index any unknown file names used by deny_info.
              */
-            ErrorDynamicPageInfo *info = ErrorDynamicPages.at(i - ERR_MAX);
+            ErrorDynamicPageInfo *info = ErrorDynamicPages.items[i - ERR_MAX];
             assert(info && info->id == i && info->page_name);
 
             const char *pg = info->page_name;
@@ -245,10 +245,8 @@ errorClean(void)
         safe_free(error_text);
     }
 
-    while (!ErrorDynamicPages.empty()) {
-        errorDynamicPageInfoDestroy(ErrorDynamicPages.back());
-        ErrorDynamicPages.pop_back();
-    }
+    while (ErrorDynamicPages.size())
+        errorDynamicPageInfoDestroy(ErrorDynamicPages.pop_back());
 
     error_page_count = 0;
 
@@ -533,7 +531,7 @@ errorPageId(const char *page_name)
     }
 
     for (size_t j = 0; j < ErrorDynamicPages.size(); ++j) {
-        if (strcmp(ErrorDynamicPages[j]->page_name, page_name) == 0)
+        if (strcmp(ErrorDynamicPages.items[j]->page_name, page_name) == 0)
             return j + ERR_MAX;
     }
 
@@ -563,7 +561,7 @@ errorPageName(int pageId)
         return err_type_str[pageId];
 
     if (pageId >= ERR_MAX && pageId - ERR_MAX < (ssize_t)ErrorDynamicPages.size())
-        return ErrorDynamicPages[pageId - ERR_MAX]->page_name;
+        return ErrorDynamicPages.items[pageId - ERR_MAX]->page_name;
 
     return "ERR_UNKNOWN";      /* should not happen */
 }
@@ -595,8 +593,8 @@ ErrorState::ErrorState(err_type t, Http::StatusCode status, HttpRequest * req) :
 {
     memset(&ftp, 0, sizeof(ftp));
 
-    if (page_id >= ERR_MAX && ErrorDynamicPages[page_id - ERR_MAX]->page_redirect != Http::scNone)
-        httpStatus = ErrorDynamicPages[page_id - ERR_MAX]->page_redirect;
+    if (page_id >= ERR_MAX && ErrorDynamicPages.items[page_id - ERR_MAX]->page_redirect != Http::scNone)
+        httpStatus = ErrorDynamicPages.items[page_id - ERR_MAX]->page_redirect;
 
     if (req != NULL) {
         request = req;
index 986406240cfebb1653322e483bc4dae6dce0b861..8f632ca79f0e10ef4e63c80f594356c77a3afebb 100644 (file)
@@ -205,8 +205,7 @@ ESICustomParser::parse(char const *dataToParse, size_t const lengthOfData, bool
                 attribute = end + 1;
             }
 
-            // TODO: after c++11, replace &attributes.front() with attributes.data()
-            theClient->start (tag + 1, const_cast<const char **>(&attributes.front()), attributes.size() >> 1);
+            theClient->start (tag + 1, (const char **)attributes.items, attributes.size() >> 1);
             /* TODO: attributes */
 
             if (*(tagEnd - 1) == '/')
index 59eddddfab4be6193e986dbcda515856711565c6..13e4f73109177c2ba95c59452f1c37c328b0532b 100644 (file)
@@ -167,10 +167,8 @@ ESIVarState::~ESIVarState()
 {
     freeResources();
 
-    while (!variablesForCleanup.empty()) {
-        delete variablesForCleanup.back();
-        variablesForCleanup.pop_back();
-    }
+    while (variablesForCleanup.size())
+        delete variablesForCleanup.pop_back();
 
     delete defaultVariable;
 }
index fdd49f30bdc340a5f7e8621a7595ecf98945165f..db883a1728e624b33bd759ebd599d72a17baecf7 100644 (file)
@@ -226,10 +226,8 @@ Fs::Ufs::UFSSwapDir::changeIO(DiskIOModule *module)
     IO->io = anIO;
     /* Change the IO Options */
 
-    if (currentIOOptions && currentIOOptions->options.size() > 2) {
-        delete currentIOOptions->options.back();
-        currentIOOptions->options.pop_back();
-    }
+    if (currentIOOptions && currentIOOptions->options.size() > 2)
+        delete currentIOOptions->options.pop_back();
 
     /* TODO: factor out these 4 lines */
     ConfigOption *ioOptions = IO->io->getOptionTree();
index ffb773a8c9733ed4b32ffce2d18e77b52c425598..17c1465144cde3c84cb657c7aaaf42c49c61a3a9 100644 (file)
@@ -19,7 +19,8 @@ Kids::Kids()
 /// maintain n kids
 void Kids::init()
 {
-    storage.clear();
+    if (storage.size() > 0)
+        storage.clean();
 
     storage.reserve(NumberOfKids());
 
index b46504f8b4863a19ea14366e7f1368d681448fd5..066cb456a25493856dd2007d82a9b0fa5ae32f9e 100644 (file)
@@ -1289,7 +1289,7 @@ storeLateRelease(void *unused)
     }
 
     for (i = 0; i < 10; ++i) {
-        e = LateReleaseStack.empty() ? NULL : LateReleaseStack.pop();
+        e = LateReleaseStack.count ? LateReleaseStack.pop() : NULL;
 
         if (e == NULL) {
             /* done! */
index 24a0ffdb6b0f78ad2775e1b0dc5939c1c3f808a1..82d6d8324cb77e444a8446da73cc32d63920e1ec 100644 (file)
@@ -1366,7 +1366,7 @@ StoreSearchHashIndex::next(void (aCallback)(void *), void *aCallbackData)
 bool
 StoreSearchHashIndex::next()
 {
-    if (!entries.empty())
+    if (entries.size())
         entries.pop_back();
 
     while (!isDone() && !entries.size())
index 160a96beb2e897faa30dcc778e0c625170f6e3f0..bbf05445121f4df5e8e9abc07cf01e2a83ded17b 100644 (file)
@@ -86,7 +86,7 @@ testRangeParser(char const *rangestring)
 
     HttpHdrRange copy(*range);
 
-    assert (copy.specs.size() == range->specs.size());
+    assert (copy.specs.count == range->specs.count);
 
     HttpHdrRange::iterator pos = range->begin();
 
@@ -111,7 +111,7 @@ void
 testRangeIter ()
 {
     HttpHdrRange *range=rangeFromString("bytes=0-3, 1-, -2");
-    assert (range->specs.size() == 3);
+    assert (range->specs.count == 3);
     size_t counter = 0;
     HttpHdrRange::iterator i = range->begin();
 
@@ -132,7 +132,7 @@ void
 testRangeCanonization()
 {
     HttpHdrRange *range=rangeFromString("bytes=0-3, 1-, -2");
-    assert (range->specs.size() == 3);
+    assert (range->specs.count == 3);
 
     /* 0-3 needs a content length of 4 */
     /* This passes in the extant code - but should it? */
@@ -140,13 +140,13 @@ testRangeCanonization()
     if (!range->canonize(3))
         exit(1);
 
-    assert (range->specs.size() == 3);
+    assert (range->specs.count == 3);
 
     delete range;
 
     range=rangeFromString("bytes=0-3, 1-, -2");
 
-    assert (range->specs.size() == 3);
+    assert (range->specs.count == 3);
 
     /* 0-3 needs a content length of 4 */
     if (!range->canonize(4))
@@ -156,7 +156,7 @@ testRangeCanonization()
 
     range=rangeFromString("bytes=3-6");
 
-    assert (range->specs.size() == 1);
+    assert (range->specs.count == 1);
 
     /* 3-6 needs a content length of 4 or more */
     if (range->canonize(3))
@@ -166,7 +166,7 @@ testRangeCanonization()
 
     range=rangeFromString("bytes=3-6");
 
-    assert (range->specs.size() == 1);
+    assert (range->specs.count == 1);
 
     /* 3-6 needs a content length of 4 or more */
     if (!range->canonize(4))
@@ -176,12 +176,12 @@ testRangeCanonization()
 
     range=rangeFromString("bytes=1-1,2-3");
 
-    assert (range->specs.size()== 2);
+    assert (range->specs.count == 2);
 
     if (!range->canonize(4))
         exit(1);
 
-    assert (range->specs.size() == 2);
+    assert (range->specs.count == 2);
 
     delete range;
 }
index 98fe5a433d01ae93da89dff8bf84624679b41994..0ec27ee7214cb1065dedc0c07eec11e5e610a3e0 100644 (file)
@@ -234,7 +234,7 @@ TunnelStateData::~TunnelStateData()
     debugs(26, 3, "TunnelStateData destructed this=" << this);
     assert(noConnections());
     xfree(url);
-    serverDestinations.clear();
+    serverDestinations.clean();
     delete connectRespBuf;
 }