From: Francesco Chemolli Date: Mon, 10 Feb 2014 12:58:49 +0000 (+0100) Subject: Migrate some users of Vector to std::vector X-Git-Tag: SQUID_3_5_0_1~376^2~8 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=81481ec0087aad9e3a85b5614a1e8ca9ccecd680;p=thirdparty%2Fsquid.git Migrate some users of Vector to std::vector --- diff --git a/src/Notes.cc b/src/Notes.cc index b35029c6b9..3a93ee3e5c 100644 --- a/src/Notes.cc +++ b/src/Notes.cc @@ -162,7 +162,7 @@ NotePairs::find(const char *noteKey) const { 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 @@ NotePairs::toString(const char *sep) const { 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 @@ NotePairs::toString(const char *sep) const 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 @@ NotePairs::addStrList(const char *key, const char *values) 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 @@ NotePairs::hasPair(const char *key, const char *value) const 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 @@ NotePairs::append(const NotePairs *src) 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())); } diff --git a/src/Notes.h b/src/Notes.h index f9e5ed0ce4..f485cf717f 100644 --- a/src/Notes.h +++ b/src/Notes.h @@ -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 @@ public: 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 ConfigParser; 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 @@ public: */ 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 diff --git a/src/StoreFileSystem.cc b/src/StoreFileSystem.cc index 293c37f4e2..fb73ae921c 100644 --- a/src/StoreFileSystem.cc +++ b/src/StoreFileSystem.cc @@ -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 @@ StoreFileSystem::FsAdd(StoreFileSystem &instance) 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; } diff --git a/src/StoreFileSystem.h b/src/StoreFileSystem.h index 81dd906bb6..3e45fefed9 100644 --- a/src/StoreFileSystem.h +++ b/src/StoreFileSystem.h @@ -116,9 +116,9 @@ public: 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 @@ protected: virtual void registerWithCacheManager(void); private: - static Vector &GetFileSystems(); - static Vector *_FileSystems; + static std::vector &GetFileSystems(); + static std::vector *_FileSystems; static void RegisterAllFsWithCacheManager(void); }; diff --git a/src/StoreHashIndex.h b/src/StoreHashIndex.h index 5a33860f48..22460566c7 100644 --- a/src/StoreHashIndex.h +++ b/src/StoreHashIndex.h @@ -117,7 +117,7 @@ private: void *cbdata; bool _done; int bucket; - Vector entries; + std::vector entries; // keep this last. it plays with private/public CBDATA_CLASS2(StoreSearchHashIndex); diff --git a/src/acl/Acl.cc b/src/acl/Acl.cc index 1e925e7542..574d66a9ed 100644 --- a/src/acl/Acl.cc +++ b/src/acl/Acl.cc @@ -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 @@ ACL::Prototype::Prototype (ACL const *aPrototype, char const *aType) : prototype registerMe (); } -Vector * ACL::Prototype::Registry; +std::vector * ACL::Prototype::Registry; void *ACL::Prototype::Initialized; bool @@ -429,7 +431,7 @@ ACL::Prototype::registerMe () if (!Registry || (Initialized != ((char *)Registry - 5)) ) { /* TODO: extract this */ /* Not initialised */ - Registry = new Vector ; + Registry = new std::vector; Initialized = (char *)Registry - 5; } diff --git a/src/acl/Acl.h b/src/acl/Acl.h index bef60f7dfb..6996348aff 100644 --- a/src/acl/Acl.h +++ b/src/acl/Acl.h @@ -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 @@ public: 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(); }; diff --git a/src/acl/NoteData.cc b/src/acl/NoteData.cc index ab4e4cfb67..cb8b032207 100644 --- a/src/acl/NoteData.cc +++ b/src/acl/NoteData.cc @@ -29,7 +29,7 @@ ACLNoteData::matchNotes(NotePairs *note) 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; diff --git a/src/adaptation/icap/Options.h b/src/adaptation/icap/Options.h index 0a0f772cb3..0d7e96c4f3 100644 --- a/src/adaptation/icap/Options.h +++ b/src/adaptation/icap/Options.h @@ -71,7 +71,7 @@ public: 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. diff --git a/src/adaptation/icap/ServiceRep.cc b/src/adaptation/icap/ServiceRep.cc index ac295a767e..4c4136c04c 100644 --- a/src/adaptation/icap/ServiceRep.cc +++ b/src/adaptation/icap/ServiceRep.cc @@ -470,7 +470,7 @@ void Adaptation::Icap::ServiceRep::checkOptions() 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()) {