------------------------------------------------------------ revno: 13269 [merge] revision-id: kinkie@squid-cache.org-20140211113520-sq4wpokg0i5bd0pz parent: squid3@treenet.co.nz-20140211091228-p971nd40rjjno55e parent: kinkie@squid-cache.org-20140211113245-bpgqb7f484o62mcr committer: Francesco Chemolli branch nick: trunk timestamp: Tue 2014-02-11 12:35:20 +0100 message: Vector refactor: move almost all clients to std::vector from Vector ------------------------------------------------------------ Use --include-merges or -n0 to see merged revisions. ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: kinkie@squid-cache.org-20140211113520-sq4wpokg0i5bd0pz # target_branch: http://bzr.squid-cache.org/bzr/squid3/trunk/ # testament_sha1: 2528471505d51f8c855c6c2fdcf06b44ac772ac3 # timestamp: 2014-02-11 11:59:51 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/trunk/ # base_revision_id: squid3@treenet.co.nz-20140211091228-\ # p971nd40rjjno55e # # Begin patch === modified file 'src/ClientDelayConfig.h' --- src/ClientDelayConfig.h 2013-05-13 23:32:23 +0000 +++ src/ClientDelayConfig.h 2014-02-10 17:52:49 +0000 @@ -2,7 +2,8 @@ #define SQUID_CLIENTDELAYCONFIG_H #include "acl/forward.h" -#include "base/Vector.h" + +#include class StoreEntry; class ConfigParser; @@ -21,7 +22,7 @@ int64_t highwatermark; }; -typedef Vector ClientDelayPools; +typedef std::vector ClientDelayPools; /* represents configuration of client write limiting delay pools */ class ClientDelayConfig === modified file 'src/ConfigOption.cc' --- src/ConfigOption.cc 2014-02-04 16:54:49 +0000 +++ src/ConfigOption.cc 2014-02-10 16:39:10 +0000 @@ -44,7 +44,7 @@ bool ConfigOptionVector::parse(char const *option, const char *value, int isaReconfig) { - Vector::iterator i = options.begin(); + std::vector::iterator i = options.begin(); while (i != options.end()) { if ((*i)->parse(option,value, isaReconfig)) @@ -59,7 +59,7 @@ void ConfigOptionVector::dump(StoreEntry * e) const { - for (Vector::const_iterator i = options.begin(); + for (std::vector::const_iterator i = options.begin(); i != options.end(); ++i) (*i)->dump(e); } === modified file 'src/ConfigOption.h' --- src/ConfigOption.h 2013-05-04 11:50:26 +0000 +++ src/ConfigOption.h 2014-02-10 16:39:10 +0000 @@ -30,7 +30,7 @@ #ifndef SQUID_CONFIGOPTION_H #define SQUID_CONFIGOPTION_H -#include "base/Vector.h" +#include class StoreEntry; @@ -53,7 +53,7 @@ virtual ~ConfigOptionVector(); virtual bool parse(char const *option, const char *value, int reconfiguring); virtual void dump(StoreEntry * e) const; - Vectoroptions; + std::vectoroptions; }; template === modified file 'src/CpuAffinityMap.cc' --- src/CpuAffinityMap.cc 2012-09-01 14:38:36 +0000 +++ src/CpuAffinityMap.cc 2014-02-10 16:39:10 +0000 @@ -10,7 +10,7 @@ #include "Debug.h" bool -CpuAffinityMap::add(const Vector &aProcesses, const Vector &aCores) +CpuAffinityMap::add(const std::vector &aProcesses, const std::vector &aCores) { if (aProcesses.size() != aCores.size()) return false; === modified file 'src/CpuAffinityMap.h' --- src/CpuAffinityMap.h 2013-05-04 11:50:26 +0000 +++ src/CpuAffinityMap.h 2014-02-10 16:39:10 +0000 @@ -4,7 +4,7 @@ #ifndef SQUID_CPU_AFFINITY_MAP_H #define SQUID_CPU_AFFINITY_MAP_H -#include "base/Vector.h" +#include class CpuAffinitySet; @@ -13,20 +13,20 @@ { public: /// append cpu_affinity_map option - bool add(const Vector &aProcesses, const Vector &aCores); + bool add(const std::vector &aProcesses, const std::vector &aCores); /// calculate CPU set for this process CpuAffinitySet *calculateSet(const int targetProcess) const; /// returns list of process numbers - const Vector &processes() const { return theProcesses; } + const std::vector &processes() const { return theProcesses; } /// returns list of cores - const Vector &cores() const { return theCores; } + const std::vector &cores() const { return theCores; } private: - Vector theProcesses; ///< list of process numbers - Vector theCores; ///< list of cores + std::vector theProcesses; ///< list of process numbers + std::vector theCores; ///< list of cores }; #endif // SQUID_CPU_AFFINITY_MAP_H === modified file 'src/DelayPools.h' --- src/DelayPools.h 2013-05-04 11:50:26 +0000 +++ src/DelayPools.h 2014-02-10 16:39:10 +0000 @@ -32,7 +32,7 @@ #ifndef SQUID_DELAYPOOLS_H #define SQUID_DELAYPOOLS_H -#include "base/Vector.h" +#include class DelayPool; class Updateable; @@ -75,7 +75,7 @@ static time_t LastUpdate; static unsigned short pools_; static void FreeDelayData (); - static Vector toUpdate; + static std::vector toUpdate; static void RegisterWithCacheManager(void); }; === modified file 'src/DelayTagged.h' --- src/DelayTagged.h 2013-10-25 00:13:46 +0000 +++ src/DelayTagged.h 2014-02-10 17:52:49 +0000 @@ -37,7 +37,6 @@ #if USE_DELAY_POOLS #include "auth/Gadgets.h" -#include "base/Vector.h" #include "CompositePoolNode.h" #include "DelayBucket.h" #include "DelayIdComposite.h" === modified file 'src/DelayVector.h' --- src/DelayVector.h 2012-09-01 14:38:36 +0000 +++ src/DelayVector.h 2014-02-10 16:39:10 +0000 @@ -72,16 +72,16 @@ private: RefCount theVector; - Vector ids; - typedef Vector::iterator iterator; - typedef Vector::const_iterator const_iterator; + std::vector ids; + typedef std::vector::iterator iterator; + typedef std::vector::const_iterator const_iterator; }; friend class Id; - Vector pools; - typedef Vector::iterator iterator; - typedef Vector::const_iterator const_iterator; + std::vector pools; + typedef std::vector::iterator iterator; + typedef std::vector::const_iterator const_iterator; }; #endif /* USE_DELAY_POOLS */ === modified file 'src/DiskIO/DiskIOModule.cc' --- src/DiskIO/DiskIOModule.cc 2014-02-04 19:47:14 +0000 +++ src/DiskIO/DiskIOModule.cc 2014-02-10 16:39:10 +0000 @@ -35,7 +35,7 @@ #include "squid.h" #include "DiskIOModule.h" -Vector *DiskIOModule::_Modules = NULL; +std::vector *DiskIOModule::_Modules = NULL; //DiskIOModule() : initialised (false) {} @@ -70,17 +70,17 @@ GetModules().push_back (&instance); } -Vector const & +std::vector const & DiskIOModule::Modules() { return GetModules(); } -Vector & +std::vector & DiskIOModule::GetModules() { if (!_Modules) - _Modules = new Vector; + _Modules = new std::vector; return *_Modules; } === modified file 'src/DiskIO/DiskIOModule.h' --- src/DiskIO/DiskIOModule.h 2013-09-03 09:05:02 +0000 +++ src/DiskIO/DiskIOModule.h 2014-02-10 16:39:10 +0000 @@ -32,7 +32,7 @@ #ifndef SQUID_DISKIOMODULE_H #define SQUID_DISKIOMODULE_H -#include "base/Vector.h" +#include /* forward decls */ @@ -57,9 +57,9 @@ * available module for this system. */ static DiskIOModule *FindDefault(); - static Vector const &Modules(); - typedef Vector::iterator iterator; - typedef Vector::const_iterator const_iterator; + static std::vector const &Modules(); + typedef std::vector::iterator iterator; + typedef std::vector::const_iterator const_iterator; DiskIOModule(); virtual ~DiskIOModule() {} @@ -78,8 +78,8 @@ static void RegisterAllModulesWithCacheManager(void); private: - static Vector &GetModules(); - static Vector *_Modules; + static std::vector &GetModules(); + static std::vector *_Modules; }; #endif /* SQUID_DISKIOMODULE_H */ === modified file 'src/EventLoop.h' --- src/EventLoop.h 2013-11-29 19:47:54 +0000 +++ src/EventLoop.h 2014-02-10 16:39:10 +0000 @@ -31,7 +31,7 @@ #ifndef SQUID_EVENTLOOP_H #define SQUID_EVENTLOOP_H -#include "base/Vector.h" +#include #define EVENT_LOOP_TIMEOUT 1000 /* 1s timeout */ @@ -104,7 +104,7 @@ bool dispatchCalls(); bool last_loop; - typedef Vector engine_vector; + typedef std::vector engine_vector; engine_vector engines; TimeEngine * timeService; AsyncEngine * primaryEngine; === modified file 'src/FadingCounter.h' --- src/FadingCounter.h 2013-05-04 11:50:26 +0000 +++ src/FadingCounter.h 2014-02-10 16:39:10 +0000 @@ -1,7 +1,7 @@ #ifndef SQUID_FADING_COUNTER_H #define SQUID_FADING_COUNTER_H -#include "base/Vector.h" +#include /// Counts events, forgetting old ones. Usefull for "3 errors/minute" limits. class FadingCounter @@ -25,7 +25,7 @@ double delta; ///< sub-interval duration = horizon/precision double lastTime; ///< time of the last update - Vector counters; ///< events per delta (possibly stale) + std::vector counters; ///< events per delta (possibly stale) int total; ///< number of remembered events (possibly stale) }; === modified file 'src/FwdState.cc' --- src/FwdState.cc 2014-02-02 09:42:23 +0000 +++ src/FwdState.cc 2014-02-10 17:52:49 +0000 @@ -472,7 +472,7 @@ entry->reset(); // drop the last path off the selection list. try the next one. - serverDestinations.shift(); + serverDestinations.erase(serverDestinations.begin()); startConnectionOrFail(); } else { @@ -611,7 +611,7 @@ if (pconnRace == raceHappened) debugs(17, 4, HERE << "retrying the same destination"); else - serverDestinations.shift(); // last one failed. try another. + serverDestinations.erase(serverDestinations.begin()); // last one failed. try another. startConnectionOrFail(); return; } === modified file 'src/FwdState.h' --- src/FwdState.h 2013-10-25 00:13:46 +0000 +++ src/FwdState.h 2014-02-10 17:52:49 +0000 @@ -2,7 +2,6 @@ #define SQUID_FORWARD_H #include "base/RefCount.h" -#include "base/Vector.h" #include "comm.h" #include "comm/Connection.h" #include "err_type.h" === modified file 'src/HttpHdrRange.cc' --- src/HttpHdrRange.cc 2014-02-04 16:54:49 +0000 +++ src/HttpHdrRange.cc 2014-02-11 11:30:51 +0000 @@ -342,7 +342,7 @@ } void -HttpHdrRange::merge (Vector &basis) +HttpHdrRange::merge (std::vector &basis) { /* reset old array */ specs.clear(); @@ -368,7 +368,7 @@ } void -HttpHdrRange::getCanonizedSpecs (Vector ©) +HttpHdrRange::getCanonizedSpecs(std::vector ©) { /* canonize each entry and destroy bad ones if any */ @@ -379,8 +379,7 @@ delete (*pos); } - debugs(64, 3, "HttpHdrRange::getCanonizedSpecs: found " << - specs.size() - copy.size() << " bad specs"); + debugs(64, 3, "found " << specs.size() - copy.size() << " bad specs"); } #include "HttpHdrContRange.h" @@ -411,7 +410,7 @@ clen = newClen; debugs(64, 3, "HttpHdrRange::canonize: started with " << specs.size() << " specs, clen: " << clen); - Vector goods; + std::vector goods; getCanonizedSpecs(goods); merge (goods); debugs(64, 3, "HttpHdrRange::canonize: finished with " << specs.size() << @@ -579,7 +578,7 @@ const HttpHdrRangeSpec * HttpHdrRangeIter::currentSpec() const { - if (pos.incrementable()) + if (pos != end) return *pos; return NULL; @@ -591,7 +590,7 @@ assert (debt_size == 0); assert (valid); - if (pos.incrementable()) { + if (pos != end) { debt(currentSpec()->length); } } === modified file 'src/HttpHeader.cc' --- src/HttpHeader.cc 2014-02-04 19:47:14 +0000 +++ src/HttpHeader.cc 2014-02-10 15:07:49 +0000 @@ -50,6 +50,8 @@ #include "StrList.h" #include "TimeOrTag.h" +#include + /* * On naming conventions: * @@ -887,7 +889,7 @@ void HttpHeader::compact() { - entries.prune(NULL); + std::remove(entries.begin(), entries.end(), static_cast(NULL)); } /* @@ -943,7 +945,7 @@ else CBIT_SET(mask, e->id); - entries.insert(e); + entries.insert(entries.begin(),e); /* increment header length, allow for ": " and crlf */ len += e->name.size() + 2 + e->value.size() + 2; === modified file 'src/HttpHeader.h' --- src/HttpHeader.h 2013-08-07 03:18:08 +0000 +++ src/HttpHeader.h 2014-02-10 22:39:56 +0000 @@ -36,6 +36,8 @@ #include "MemPool.h" #include "SquidString.h" +#include + /* class forward declarations */ class HttpHdrCc; class HttpHdrContRange; @@ -283,7 +285,7 @@ inline bool chunked() const; ///< whether message uses chunked Transfer-Encoding /* protected, do not use these, use interface functions instead */ - Vector entries; /**< parsed fields in raw format */ + std::vector entries; /**< parsed fields in raw format */ HttpHeaderMask mask; /**< bit set <=> entry present */ http_hdr_owner_type owner; /**< request or reply */ int len; /**< length when packed, not counting terminating null-byte */ === modified file 'src/HttpHeaderRange.h' --- src/HttpHeaderRange.h 2013-05-04 11:50:26 +0000 +++ src/HttpHeaderRange.h 2014-02-10 22:39:56 +0000 @@ -1,4 +1,3 @@ - /* * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -32,12 +31,13 @@ #ifndef SQUID_HTTPHEADERRANGE_H #define SQUID_HTTPHEADERRANGE_H -#include "base/Vector.h" #include "MemPool.h" #include "Packer.h" #include "Range.h" #include "SquidString.h" +#include + class HttpReply; /* http byte-range-spec */ @@ -83,8 +83,8 @@ ~HttpHdrRange(); HttpHdrRange &operator= (HttpHdrRange const &); - typedef Vector::iterator iterator; - typedef Vector::const_iterator const_iterator; + typedef std::vector::iterator iterator; + typedef std::vector::const_iterator const_iterator; iterator begin(); const_iterator begin () const; iterator end(); @@ -103,11 +103,11 @@ int64_t lowestOffset(int64_t) const; bool offsetLimitExceeded(const int64_t limit) const; bool contains(HttpHdrRangeSpec& r) const; - Vector specs; + std::vector specs; private: - void getCanonizedSpecs (Vector ©); - void merge (Vector &basis); + void getCanonizedSpecs (std::vector ©); + void merge (std::vector &basis); int64_t clen; }; @@ -121,6 +121,7 @@ public: HttpHdrRange::iterator pos; + HttpHdrRange::iterator end; const HttpHdrRangeSpec *currentSpec() const; void updateSpec(); int64_t debt() const; === modified file 'src/Notes.cc' --- src/Notes.cc 2014-02-02 18:19:59 +0000 +++ src/Notes.cc 2014-02-10 12:58:49 +0000 @@ -162,7 +162,7 @@ { static String value; value.clean(); - for (Vector::const_iterator i = entries.begin(); i != entries.end(); ++i) { + for (std::vector::const_iterator i = entries.begin(); i != entries.end(); ++i) { if ((*i)->name.cmp(noteKey) == 0) { if (value.size()) value.append(", "); @@ -177,7 +177,7 @@ { static String value; value.clean(); - for (Vector::const_iterator i = entries.begin(); i != entries.end(); ++i) { + for (std::vector::const_iterator i = entries.begin(); i != entries.end(); ++i) { value.append((*i)->name); value.append(": "); value.append(ConfigParser::QuoteString((*i)->value)); @@ -189,7 +189,7 @@ const char * NotePairs::findFirst(const char *noteKey) const { - for (Vector::const_iterator i = entries.begin(); i != entries.end(); ++i) { + for (std::vector::const_iterator i = entries.begin(); i != entries.end(); ++i) { if ((*i)->name.cmp(noteKey) == 0) return (*i)->value.termedBuf(); } @@ -219,7 +219,7 @@ bool NotePairs::hasPair(const char *key, const char *value) const { - for (Vector::const_iterator i = entries.begin(); i != entries.end(); ++i) { + for (std::vector::const_iterator i = entries.begin(); i != entries.end(); ++i) { if ((*i)->name.cmp(key) == 0 && (*i)->value.cmp(value) == 0) return true; } @@ -229,7 +229,7 @@ void NotePairs::append(const NotePairs *src) { - for (Vector::const_iterator i = src->entries.begin(); i != src->entries.end(); ++i) { + for (std::vector::const_iterator i = src->entries.begin(); i != src->entries.end(); ++i) { entries.push_back(new NotePairs::Entry((*i)->name.termedBuf(), (*i)->value.termedBuf())); } } @@ -237,7 +237,7 @@ void NotePairs::appendNewOnly(const NotePairs *src) { - for (Vector::const_iterator i = src->entries.begin(); i != src->entries.end(); ++i) { + for (std::vector::const_iterator i = src->entries.begin(); i != src->entries.end(); ++i) { if (!hasPair((*i)->name.termedBuf(), (*i)->value.termedBuf())) entries.push_back(new NotePairs::Entry((*i)->name.termedBuf(), (*i)->value.termedBuf())); } === modified file 'src/Notes.h' --- src/Notes.h 2014-02-02 09:42:23 +0000 +++ src/Notes.h 2014-02-10 12:58:49 +0000 @@ -3,7 +3,6 @@ #include "acl/forward.h" #include "base/RefCount.h" -#include "base/Vector.h" #include "CbDataList.h" #include "format/Format.h" #include "MemPool.h" @@ -13,6 +12,7 @@ #if HAVE_STRING #include #endif +#include class HttpRequest; class HttpReply; @@ -40,7 +40,7 @@ explicit Value(const String &aVal) : value(aVal), aclList(NULL), valueFormat(NULL) {} ~Value(); }; - typedef Vector Values; + typedef std::vector Values; explicit Note(const String &aKey): key(aKey) {} @@ -70,7 +70,7 @@ class Notes { public: - typedef Vector NotesList; + typedef std::vector NotesList; typedef NotesList::iterator iterator; ///< iterates over the notes list typedef NotesList::const_iterator const_iterator; ///< iterates over the notes list @@ -184,7 +184,7 @@ */ bool empty() const {return entries.empty();} - Vector entries; ///< The key/value pair entries + std::vector entries; ///< The key/value pair entries private: NotePairs &operator = (NotePairs const &); // Not implemented === modified file 'src/PeerSelectState.h' --- src/PeerSelectState.h 2013-12-06 14:59:47 +0000 +++ src/PeerSelectState.h 2014-02-10 17:52:49 +0000 @@ -35,7 +35,6 @@ #include "AccessLogEntry.h" #include "acl/Checklist.h" -#include "base/Vector.h" #include "cbdata.h" #include "comm/forward.h" #include "hier_code.h" === modified file 'src/StoreFileSystem.cc' --- src/StoreFileSystem.cc 2014-02-04 19:47:14 +0000 +++ src/StoreFileSystem.cc 2014-02-10 12:58:49 +0000 @@ -35,7 +35,7 @@ #include "squid.h" #include "StoreFileSystem.h" -Vector *StoreFileSystem::_FileSystems = NULL; +std::vector *StoreFileSystem::_FileSystems = NULL; void StoreFileSystem::RegisterAllFsWithCacheManager(void) @@ -65,17 +65,17 @@ GetFileSystems().push_back (&instance); } -Vector const & +std::vector const & StoreFileSystem::FileSystems() { return GetFileSystems(); } -Vector & +std::vector & StoreFileSystem::GetFileSystems() { if (!_FileSystems) - _FileSystems = new Vector; + _FileSystems = new std::vector; return *_FileSystems; } === modified file 'src/StoreFileSystem.h' --- src/StoreFileSystem.h 2013-09-30 12:30:50 +0000 +++ src/StoreFileSystem.h 2014-02-10 17:52:49 +0000 @@ -31,7 +31,7 @@ #ifndef SQUID_STOREFILESYSTEM_H #define SQUID_STOREFILESYSTEM_H -#include "base/Vector.h" +#include /* ****** DOCUMENTATION ***** */ @@ -116,9 +116,9 @@ static void SetupAllFs(); static void FsAdd(StoreFileSystem &); static void FreeAllFs(); - static Vector const &FileSystems(); - typedef Vector::iterator iterator; - typedef Vector::const_iterator const_iterator; + static std::vector const &FileSystems(); + typedef std::vector::iterator iterator; + typedef std::vector::const_iterator const_iterator; StoreFileSystem() : initialised(false) {} virtual ~StoreFileSystem() {} @@ -136,8 +136,8 @@ virtual void registerWithCacheManager(void); private: - static Vector &GetFileSystems(); - static Vector *_FileSystems; + static std::vector &GetFileSystems(); + static std::vector *_FileSystems; static void RegisterAllFsWithCacheManager(void); }; === modified file 'src/StoreHashIndex.h' --- src/StoreHashIndex.h 2012-10-16 00:18:09 +0000 +++ src/StoreHashIndex.h 2014-02-10 12:58:49 +0000 @@ -117,7 +117,7 @@ void *cbdata; bool _done; int bucket; - Vector entries; + std::vector entries; // keep this last. it plays with private/public CBDATA_CLASS2(StoreSearchHashIndex); === modified file 'src/acl/Acl.cc' --- src/acl/Acl.cc 2014-01-06 20:55:13 +0000 +++ src/acl/Acl.cc 2014-02-10 12:58:49 +0000 @@ -41,6 +41,8 @@ #include "profiler/Profiler.h" #include "SquidConfig.h" +#include + const ACLFlag ACLFlags::NoFlags[1] = {ACL_F_END}; const char *AclMatchedName = NULL; @@ -405,7 +407,7 @@ registerMe (); } -Vector * ACL::Prototype::Registry; +std::vector * ACL::Prototype::Registry; void *ACL::Prototype::Initialized; bool @@ -429,7 +431,7 @@ if (!Registry || (Initialized != ((char *)Registry - 5)) ) { /* TODO: extract this */ /* Not initialised */ - Registry = new Vector ; + Registry = new std::vector; Initialized = (char *)Registry - 5; } === modified file 'src/acl/Acl.h' --- src/acl/Acl.h 2014-01-11 01:35:50 +0000 +++ src/acl/Acl.h 2014-02-10 12:58:49 +0000 @@ -34,7 +34,6 @@ #define SQUID_ACL_H #include "acl/forward.h" -#include "base/Vector.h" #include "cbdata.h" #include "defines.h" #include "dlink.h" @@ -46,6 +45,7 @@ #if HAVE_STRING #include #endif +#include class ConfigParser; @@ -157,10 +157,10 @@ char const *typeString; private: - static Vector * Registry; + static std::vector * Registry; static void *Initialized; - typedef Vector::iterator iterator; - typedef Vector::const_iterator const_iterator; + typedef std::vector::iterator iterator; + typedef std::vector::const_iterator const_iterator; void registerMe(); }; === modified file 'src/acl/NoteData.cc' --- src/acl/NoteData.cc 2013-10-31 19:13:17 +0000 +++ src/acl/NoteData.cc 2014-02-10 12:58:49 +0000 @@ -29,7 +29,7 @@ if (values->empty()) return (note->findFirst(name.termedBuf()) != NULL); - for (Vector::iterator i = note->entries.begin(); i!= note->entries.end(); ++i) { + for (std::vector::iterator i = note->entries.begin(); i!= note->entries.end(); ++i) { if ((*i)->name.cmp(name.termedBuf()) == 0) { if (values->match((*i)->value.termedBuf())) return true; === modified file 'src/adaptation/AccessCheck.cc' --- src/adaptation/AccessCheck.cc 2014-02-02 08:57:20 +0000 +++ src/adaptation/AccessCheck.cc 2014-02-10 16:39:10 +0000 @@ -131,7 +131,7 @@ return; } - candidates.shift(); // the rule apparently went away (reconfigure) + candidates.erase(candidates.begin()); // the rule apparently went away (reconfigure) } debugs(93, 4, HERE << "NO candidates left"); @@ -176,7 +176,7 @@ } // no match or the group disappeared during reconfiguration - candidates.shift(); + candidates.erase(candidates.begin()); checkCandidates(); } === modified file 'src/adaptation/AccessCheck.h' --- src/adaptation/AccessCheck.h 2014-02-08 13:36:42 +0000 +++ src/adaptation/AccessCheck.h 2014-02-10 16:39:10 +0000 @@ -39,7 +39,7 @@ ACLFilledChecklist *acl_checklist; typedef int Candidate; - typedef Vector Candidates; + typedef std::vector Candidates; Candidates candidates; Candidate topCandidate() const { return *candidates.begin(); } ServiceGroupPointer topGroup() const; // may return nil === modified file 'src/adaptation/AccessRule.h' --- src/adaptation/AccessRule.h 2013-05-13 22:48:23 +0000 +++ src/adaptation/AccessRule.h 2014-02-10 22:39:56 +0000 @@ -5,6 +5,8 @@ #include "adaptation/forward.h" #include "SquidString.h" +#include + class ConfigParser; namespace Adaptation @@ -34,7 +36,7 @@ static Id LastId; }; -typedef Vector AccessRules; +typedef std::vector AccessRules; AccessRules &AllRules(); AccessRule *FindRule(const AccessRule::Id &id); AccessRule *FindRuleByGroupId(const String &groupId); === modified file 'src/adaptation/Config.cc' --- src/adaptation/Config.cc 2014-02-02 09:42:23 +0000 +++ src/adaptation/Config.cc 2014-02-11 11:30:51 +0000 @@ -36,13 +36,14 @@ #include "adaptation/History.h" #include "adaptation/Service.h" #include "adaptation/ServiceGroups.h" -#include "base/Vector.h" #include "ConfigParser.h" #include "globals.h" #include "HttpReply.h" #include "HttpRequest.h" #include "Store.h" +#include + bool Adaptation::Config::Enabled = false; char *Adaptation::Config::masterx_shared_name = NULL; int Adaptation::Config::service_iteration_limit = 16; @@ -87,15 +88,15 @@ for (SGSI it = services.begin(); it != services.end(); ++it) { if (*it == service) { group->removedServices.push_back(service); - group->services.prune(service); - debugs(93, 5, HERE << "adaptation service " << service << + std::remove(group->services.begin(), group->services.end(), service); + debugs(93, 5, "adaptation service " << service << " removed from group " << group->id); break; } } if (services.empty()) { removeRule(group->id); - AllGroups().prune(group); + std::remove(AllGroups().begin(), AllGroups().end(), group); } else { ++i; } @@ -122,8 +123,8 @@ for (ARI it = rules.begin(); it != rules.end(); ++it) { AccessRule* rule = *it; if (rule->groupId == id) { - debugs(93, 5, HERE << "removing access rules for:" << id); - AllRules().prune(rule); + debugs(93, 5, "removing access rules for:" << id); + std::remove(AllRules().begin(), AllRules().end(), rule); delete (rule); break; } === modified file 'src/adaptation/Config.h' --- src/adaptation/Config.h 2013-11-12 14:48:50 +0000 +++ src/adaptation/Config.h 2014-02-10 16:39:10 +0000 @@ -51,7 +51,7 @@ static bool needHistory; ///< HttpRequest adaptation history should recorded - typedef Vector ServiceConfigs; + typedef std::vector ServiceConfigs; ServiceConfigs serviceConfigs; Config(); === modified file 'src/adaptation/DynamicGroupCfg.h' --- src/adaptation/DynamicGroupCfg.h 2013-05-04 11:50:26 +0000 +++ src/adaptation/DynamicGroupCfg.h 2014-02-10 16:39:10 +0000 @@ -1,9 +1,10 @@ #ifndef SQUID_ADAPTATION__DYNAMIC_GROUP_CFG_H #define SQUID_ADAPTATION__DYNAMIC_GROUP_CFG_H -#include "base/Vector.h" #include "SquidString.h" +#include + namespace Adaptation { @@ -11,7 +12,7 @@ class DynamicGroupCfg { public: - typedef Vector Store; + typedef std::vector Store; typedef String Id; Id id; ///< group id === modified file 'src/adaptation/History.h' --- src/adaptation/History.h 2013-11-12 14:48:50 +0000 +++ src/adaptation/History.h 2014-02-10 17:52:49 +0000 @@ -3,7 +3,6 @@ #include "adaptation/DynamicGroupCfg.h" #include "base/RefCount.h" -#include "base/Vector.h" #include "HttpHeader.h" #include "Notes.h" #include "SBuf.h" @@ -57,7 +56,7 @@ /// AccessLogEntry::notes when ALE becomes available NotePairs::Pointer metaHeaders; - typedef Vector AdaptationServices; + typedef std::vector AdaptationServices; AdaptationServices theAdaptationServices; ///< The service groups used /// sets future services for the Adaptation::AccessCheck to notice @@ -87,7 +86,7 @@ bool retried; ///< whether the xaction was replaced by another }; - typedef Vector Entries; + typedef std::vector Entries; Entries theEntries; ///< historical record, in the order of xact starts // theXx* will become a map, but we only support one record === modified file 'src/adaptation/Service.h' --- src/adaptation/Service.h 2013-12-05 11:04:45 +0000 +++ src/adaptation/Service.h 2014-02-10 16:39:10 +0000 @@ -61,7 +61,7 @@ typedef Service::Pointer ServicePointer; -typedef Vector Services; +typedef std::vector Services; Services &AllServices(); ServicePointer FindService(const Service::Id &key); === modified file 'src/adaptation/ServiceGroups.h' --- src/adaptation/ServiceGroups.h 2013-10-25 00:13:46 +0000 +++ src/adaptation/ServiceGroups.h 2014-02-10 16:39:10 +0000 @@ -4,9 +4,10 @@ #include "adaptation/Elements.h" #include "adaptation/forward.h" #include "base/RefCount.h" -#include "base/Vector.h" #include "SquidString.h" +#include + namespace Adaptation { @@ -17,9 +18,9 @@ public: typedef RefCount Pointer; - typedef Vector Store; + typedef std::vector Store; typedef String Id; - typedef unsigned int Pos; // Vector<>::poistion_type + typedef unsigned int Pos; // vector<>::position_type friend class ServicePlan; public: @@ -113,7 +114,7 @@ class ServicePlan { public: - typedef unsigned int Pos; // Vector<>::poistion_type + typedef unsigned int Pos; // vector<>::position_type public: ServicePlan(); @@ -141,7 +142,7 @@ return p.print(os); } -typedef Vector Groups; +typedef std::vector Groups; Groups &AllGroups(); ServiceGroupPointer FindGroup(const ServiceGroup::Id &id); === modified file 'src/adaptation/icap/Config.cc' --- src/adaptation/icap/Config.cc 2013-10-25 00:13:46 +0000 +++ src/adaptation/icap/Config.cc 2014-02-10 16:39:10 +0000 @@ -33,7 +33,6 @@ #include "squid.h" #include "adaptation/icap/Config.h" #include "adaptation/icap/ServiceRep.h" -#include "base/Vector.h" #include "ConfigParser.h" #include "HttpReply.h" #include "HttpRequest.h" === modified file 'src/adaptation/icap/Options.h' --- src/adaptation/icap/Options.h 2012-09-01 14:38:36 +0000 +++ src/adaptation/icap/Options.h 2014-02-10 12:58:49 +0000 @@ -71,7 +71,7 @@ const char *error; // human-readable information; set iff !valid() // ICAP server MUST supply this info - Vector methods; + std::vector methods; String istag; // ICAP server MAY supply this info. If not, Squid supplies defaults. === modified file 'src/adaptation/icap/ServiceRep.cc' --- src/adaptation/icap/ServiceRep.cc 2014-02-04 19:47:14 +0000 +++ src/adaptation/icap/ServiceRep.cc 2014-02-10 12:58:49 +0000 @@ -470,7 +470,7 @@ if (!theOptions->methods.empty()) { bool method_found = false; String method_list; - Vector ::iterator iter = theOptions->methods.begin(); + std::vector ::iterator iter = theOptions->methods.begin(); while (iter != theOptions->methods.end()) { === modified file 'src/adaptation/icap/ServiceRep.h' --- src/adaptation/icap/ServiceRep.h 2014-01-11 01:35:50 +0000 +++ src/adaptation/icap/ServiceRep.h 2014-02-10 16:39:10 +0000 @@ -140,7 +140,7 @@ AsyncCall::Pointer callback; }; - typedef Vector Clients; + typedef std::vector Clients; // TODO: rename to theUpWaiters Clients theClients; // all clients waiting for a call back === modified file 'src/auth/Config.h' --- src/auth/Config.h 2014-02-10 11:08:58 +0000 +++ src/auth/Config.h 2014-02-10 17:18:48 +0000 @@ -150,7 +150,7 @@ Format::Format *keyExtras; ///< The compiled request format }; -typedef Vector ConfigVector; +typedef std::vector ConfigVector; extern ConfigVector TheConfig; === modified file 'src/auth/Scheme.cc' --- src/auth/Scheme.cc 2013-10-25 00:13:46 +0000 +++ src/auth/Scheme.cc 2014-02-10 17:18:48 +0000 @@ -37,7 +37,7 @@ #include "auth/Scheme.h" #include "globals.h" -Vector *Auth::Scheme::_Schemes = NULL; +std::vector *Auth::Scheme::_Schemes = NULL; void Auth::Scheme::AddScheme(Auth::Scheme::Pointer instance) @@ -63,11 +63,11 @@ return Auth::Scheme::Pointer(NULL); } -Vector & +std::vector & Auth::Scheme::GetSchemes() { if (!_Schemes) - _Schemes = new Vector; + _Schemes = new std::vector; return *_Schemes; } === modified file 'src/auth/Scheme.h' --- src/auth/Scheme.h 2013-10-25 00:13:46 +0000 +++ src/auth/Scheme.h 2014-02-10 17:18:48 +0000 @@ -34,7 +34,8 @@ #if USE_AUTH #include "base/RefCount.h" -#include "base/Vector.h" + +#include /** \defgroup AuthSchemeAPI Authentication Scheme API @@ -60,8 +61,8 @@ { public: typedef RefCount Pointer; - typedef Vector::iterator iterator; - typedef Vector::const_iterator const_iterator; + typedef std::vector::iterator iterator; + typedef std::vector::const_iterator const_iterator; public: Scheme() : initialised (false) {}; @@ -93,13 +94,13 @@ Scheme(Scheme const &); Scheme &operator=(Scheme const&); - static Vector &GetSchemes(); + static std::vector &GetSchemes(); protected: bool initialised; private: - static Vector *_Schemes; + static std::vector *_Schemes; }; } // namespace Auth === modified file 'src/base/Vector.h' --- src/base/Vector.h 2014-02-07 15:37:11 +0000 +++ src/base/Vector.h 2014-02-10 17:52:49 +0000 @@ -32,7 +32,7 @@ #define SQUID_ARRAY_H /** - \todo CLEANUP: this file should be called Vector.h at least, and probably be replaced by STL Vector + \todo remove this after replacing with STL */ #include "fatal.h" === modified file 'src/cache_cf.cc' --- src/cache_cf.cc 2014-02-10 09:59:19 +0000 +++ src/cache_cf.cc 2014-02-10 16:39:10 +0000 @@ -250,7 +250,7 @@ static void parse_b_size_t(size_t * var); static void parse_b_int64_t(int64_t * var); -static bool parseNamedIntList(const char *data, const String &name, Vector &list); +static bool parseNamedIntList(const char *data, const String &name, std::vector &list); static void parse_CpuAffinityMap(CpuAffinityMap **const cpuAffinityMap); static void dump_CpuAffinityMap(StoreEntry *const entry, const char *const name, const CpuAffinityMap *const cpuAffinityMap); @@ -490,7 +490,7 @@ config_lineno = 0; - Vector if_states; + std::vector if_states; while (fgets(config_input_line, BUFSIZ, fp)) { ++config_lineno; @@ -4261,7 +4261,7 @@ /// parses list of integers form name=N1,N2,N3,... static bool -parseNamedIntList(const char *data, const String &name, Vector &list) +parseNamedIntList(const char *data, const String &name, std::vector &list) { if (data && (strncmp(data, name.rawBuf(), name.size()) == 0)) { data += name.size(); @@ -4294,7 +4294,7 @@ const char *const pToken = ConfigParser::NextToken(); const char *const cToken = ConfigParser::NextToken(); - Vector processes, cores; + std::vector processes, cores; if (!parseNamedIntList(pToken, "process_numbers", processes)) { debugs(3, DBG_CRITICAL, "FATAL: bad 'process_numbers' parameter " << "in 'cpu_affinity_map'"); === modified file 'src/client_side.cc' --- src/client_side.cc 2014-02-10 09:59:19 +0000 +++ src/client_side.cc 2014-02-10 13:55:54 +0000 @@ -1713,7 +1713,7 @@ if (!http->range_iter.debt()) { debugs(33, 5, HERE << "At end of current range spec for " << clientConnection); - if (http->range_iter.pos.incrementable()) + if (http->range_iter.pos != http->range_iter.end) ++http->range_iter.pos; http->range_iter.updateSpec(); === modified file 'src/client_side_request.cc' --- src/client_side_request.cc 2013-12-06 23:52:26 +0000 +++ src/client_side_request.cc 2014-02-10 13:55:54 +0000 @@ -1139,6 +1139,7 @@ */ node->readBuffer.offset = request->range->lowestOffset(0); http->range_iter.pos = request->range->begin(); + http->range_iter.end = request->range->end(); http->range_iter.valid = true; } } === modified file 'src/comm/AcceptLimiter.cc' --- src/comm/AcceptLimiter.cc 2013-03-26 10:38:20 +0000 +++ src/comm/AcceptLimiter.cc 2014-02-10 17:18:48 +0000 @@ -47,7 +47,8 @@ debugs(5, 5, "size=" << deferred_.size()); while (deferred_.size() > 0 && fdNFree() >= RESERVED_FD) { /* NP: shift() is equivalent to pop_front(). Giving us a FIFO queue. */ - TcpAcceptor::Pointer temp = deferred_.shift(); + TcpAcceptor::Pointer temp = deferred_.front(); + deferred_.erase(deferred_.begin()); if (temp.valid()) { debugs(5, 5, "doing one."); -- temp->isLimited; === modified file 'src/comm/AcceptLimiter.h' --- src/comm/AcceptLimiter.h 2013-05-04 11:50:26 +0000 +++ src/comm/AcceptLimiter.h 2014-02-10 17:18:48 +0000 @@ -1,9 +1,10 @@ #ifndef _SQUID_SRC_COMM_ACCEPT_LIMITER_H #define _SQUID_SRC_COMM_ACCEPT_LIMITER_H -#include "base/Vector.h" #include "comm/TcpAcceptor.h" +#include + namespace Comm { @@ -24,7 +25,7 @@ * or to NULL an entry while scanning the list for empty spaces. * Side effect: TcpAcceptor->kick() becomes allowed to pull off multiple accept()'s in bunches * - * 2) re-implement as a list instead of vector? + * 2) re-implement as a std::queue instead of std::vector * storing head/tail pointers for fast push/pop and avoiding the whole shift() overhead */ class AcceptLimiter @@ -47,7 +48,7 @@ static AcceptLimiter Instance_; /** FIFO queue */ - Vector deferred_; + std::vector deferred_; }; }; // namepace Comm === modified file 'src/comm/forward.h' --- src/comm/forward.h 2013-10-25 00:13:46 +0000 +++ src/comm/forward.h 2014-02-10 17:18:48 +0000 @@ -2,7 +2,8 @@ #define _SQUID_COMM_FORWARD_H #include "base/RefCount.h" -#include "base/Vector.h" + +#include namespace Comm { @@ -11,7 +12,7 @@ typedef RefCount ConnectionPointer; -typedef Vector ConnectionList; +typedef std::vector ConnectionList; bool IsConnOpen(const Comm::ConnectionPointer &conn); === modified file 'src/delay_pools.cc' --- src/delay_pools.cc 2013-10-25 00:13:46 +0000 +++ src/delay_pools.cc 2014-02-10 16:39:10 +0000 @@ -42,7 +42,6 @@ #include "squid.h" #if USE_DELAY_POOLS -#include "base/Vector.h" #include "client_side_request.h" #include "comm/Connection.h" #include "CommonPool.h" @@ -592,7 +591,7 @@ LastUpdate = squid_curtime; - Vector::iterator pos = toUpdate.begin(); + std::vector::iterator pos = toUpdate.begin(); while (pos != toUpdate.end()) { (*pos)->update(incr); @@ -610,7 +609,7 @@ void DelayPools::deregisterForUpdates (Updateable *anObject) { - Vector::iterator pos = toUpdate.begin(); + std::vector::iterator pos = toUpdate.begin(); while (pos != toUpdate.end() && *pos != anObject) { ++pos; @@ -618,7 +617,7 @@ if (pos != toUpdate.end()) { /* move all objects down one */ - Vector::iterator temp = pos; + std::vector::iterator temp = pos; ++pos; while (pos != toUpdate.end()) { @@ -631,7 +630,7 @@ } } -Vector DelayPools::toUpdate; +std::vector DelayPools::toUpdate; void DelayPools::Stats(StoreEntry * sentry) === modified file 'src/errorpage.cc' --- src/errorpage.cc 2014-02-07 16:14:42 +0000 +++ src/errorpage.cc 2014-02-10 16:39:10 +0000 @@ -119,7 +119,7 @@ }; /// \ingroup ErrorPageInternal -static Vector ErrorDynamicPages; +static std::vector ErrorDynamicPages; /* local prototypes */ === modified file 'src/esi/CustomParser.cc' --- src/esi/CustomParser.cc 2014-02-10 09:19:56 +0000 +++ src/esi/CustomParser.cc 2014-02-10 16:39:10 +0000 @@ -32,12 +32,14 @@ */ #include "squid.h" -#include "base/Vector.h" #include "Debug.h" #include "esi/CustomParser.h" +#include "fatal.h" #include "libTrie/Trie.h" #include "libTrie/TrieCharTransform.h" +#include + Trie *ESICustomParser::SearchTrie=NULL; EsiParserDefinition(ESICustomParser); @@ -147,7 +149,7 @@ *tagEnd = '\0'; - Vectorattributes; + std::vectorattributes; char *attribute = const_cast(endofName + 1); === modified file 'src/esi/VarState.h' --- src/esi/VarState.h 2013-10-25 00:13:46 +0000 +++ src/esi/VarState.h 2014-02-10 17:18:48 +0000 @@ -32,11 +32,12 @@ #ifndef SQUID_ESIVARSTATE_H #define SQUID_ESIVARSTATE_H -#include "base/Vector.h" #include "esi/Segment.h" #include "HttpHeader.h" #include "libTrie/Trie.h" +#include + class HttpReply; /* esi variable replacement logic */ @@ -117,7 +118,7 @@ void doIt (); void setupUserAgent(); Trie variables; - Vector variablesForCleanup; + std::vector variablesForCleanup; Variable *defaultVariable; }; === modified file 'src/event.h' --- src/event.h 2013-10-31 16:22:17 +0000 +++ src/event.h 2014-02-10 17:52:49 +0000 @@ -33,7 +33,6 @@ #define SQUID_EVENT_H #include "AsyncEngine.h" -#include "base/Vector.h" #include "MemPool.h" class StoreEntry; === modified file 'src/fs/rock/RockSwapDir.h' --- src/fs/rock/RockSwapDir.h 2013-12-31 18:49:41 +0000 +++ src/fs/rock/RockSwapDir.h 2014-02-10 16:39:10 +0000 @@ -146,8 +146,8 @@ virtual void create(const RunnerRegistry &); private: - Vector mapOwners; - Vector< Ipc::Mem::Owner *> freeSlotsOwners; + std::vector mapOwners; + std::vector< Ipc::Mem::Owner *> freeSlotsOwners; }; } // namespace Rock === modified file 'src/ipc/Coordinator.h' --- src/ipc/Coordinator.h 2013-05-04 11:50:26 +0000 +++ src/ipc/Coordinator.h 2014-02-10 17:52:49 +0000 @@ -6,7 +6,6 @@ #ifndef SQUID_IPC_COORDINATOR_H #define SQUID_IPC_COORDINATOR_H -#include "base/Vector.h" #include "ipc/Messages.h" #include "ipc/Port.h" #include "ipc/SharedListen.h" === modified file 'src/ipc/Kids.h' --- src/ipc/Kids.h 2013-05-04 11:50:26 +0000 +++ src/ipc/Kids.h 2014-02-10 16:39:10 +0000 @@ -4,9 +4,10 @@ #ifndef SQUID_IPC_KIDS_H #define SQUID_IPC_KIDS_H -#include "base/Vector.h" #include "ipc/Kid.h" +#include + /// a collection of kids class Kids { @@ -46,7 +47,7 @@ size_t count() const; private: - Vector storage; + std::vector storage; }; extern Kids TheKids; ///< All kids being maintained === modified file 'src/ipc/Queue.h' --- src/ipc/Queue.h 2014-01-03 11:13:52 +0000 +++ src/ipc/Queue.h 2014-02-10 17:52:49 +0000 @@ -5,7 +5,6 @@ #define SQUID_IPC_QUEUE_H #include "base/InstanceId.h" -#include "base/Vector.h" #include "Debug.h" #include "ipc/AtomicWord.h" #include "ipc/mem/FlexibleArray.h" === modified file 'src/tests/stub_DiskIOModule.cc' --- src/tests/stub_DiskIOModule.cc 2012-01-20 18:55:04 +0000 +++ src/tests/stub_DiskIOModule.cc 2014-02-10 17:18:48 +0000 @@ -4,10 +4,13 @@ #include "tests/STUB.h" #include "DiskIO/DiskIOModule.h" + +#include + void DiskIOModule::SetupAllModules() STUB void DiskIOModule::ModuleAdd(DiskIOModule &) STUB void DiskIOModule::FreeAllModules() STUB void DiskIOModule::PokeAllModules() STUB DiskIOModule *DiskIOModule::Find(char const *) STUB_RETVAL(NULL) DiskIOModule *DiskIOModule::FindDefault() STUB_RETVAL(NULL) -Vector const &DiskIOModule::Modules() STUB_RETSTATREF(Vector) +std::vector const &DiskIOModule::Modules() STUB_RETSTATREF(std::vector) === modified file 'src/tests/stub_libauth.cc' --- src/tests/stub_libauth.cc 2013-12-06 14:59:47 +0000 +++ src/tests/stub_libauth.cc 2014-02-10 17:18:48 +0000 @@ -21,10 +21,11 @@ Auth::User::Pointer AuthUserHashPointer::user() const STUB_RETVAL(NULL) #include "auth/Scheme.h" -Vector *Auth::Scheme::_Schemes = NULL; +#include +std::vector *Auth::Scheme::_Schemes = NULL; void Auth::Scheme::AddScheme(Auth::Scheme::Pointer) STUB Auth::Scheme::Pointer Auth::Scheme::Find(const char *) STUB_RETVAL(NULL) -Vector & Auth::Scheme::GetSchemes() STUB_RETVAL(*_Schemes); +std::vector & Auth::Scheme::GetSchemes() STUB_RETVAL(*_Schemes); void Auth::Scheme::FreeAll() STUB #include "auth/User.h" === modified file 'src/tunnel.cc' --- src/tunnel.cc 2014-02-02 09:42:23 +0000 +++ src/tunnel.cc 2014-02-10 17:52:49 +0000 @@ -33,7 +33,6 @@ #include "squid.h" #include "acl/FilledChecklist.h" -#include "base/Vector.h" #include "CachePeer.h" #include "client_side.h" #include "client_side_request.h" @@ -779,7 +778,7 @@ /* At this point only the TCP handshake has failed. no data has been passed. * we are allowed to re-try the TCP-level connection to alternate IPs for CONNECT. */ - tunnelState->serverDestinations.shift(); + tunnelState->serverDestinations.erase(tunnelState->serverDestinations.begin()); if (status != COMM_TIMEOUT && tunnelState->serverDestinations.size() > 0) { /* Try another IP of this destination host */