From: Francesco Chemolli Date: Mon, 10 Feb 2014 17:18:48 +0000 (+0100) Subject: Refactor all users of Vector to std::vector except for Stack X-Git-Tag: SQUID_3_5_0_1~376^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=523c3de3eeaddabe8a52d2c4435b08409c0b8774;p=thirdparty%2Fsquid.git Refactor all users of Vector to std::vector except for Stack --- diff --git a/src/FwdState.cc b/src/FwdState.cc index 881cb94dad..d5482e4173 100644 --- a/src/FwdState.cc +++ b/src/FwdState.cc @@ -472,7 +472,7 @@ FwdState::complete() entry->reset(); // drop the last path off the selection list. try the next one. - serverDestinations.shift(); + serverDestinations.erase(serverDestinations.begin()); startConnectionOrFail(); } else { diff --git a/src/auth/Config.h b/src/auth/Config.h index aa731adfa3..ad4da18ab9 100644 --- a/src/auth/Config.h +++ b/src/auth/Config.h @@ -150,7 +150,7 @@ public: Format::Format *keyExtras; ///< The compiled request format }; -typedef Vector ConfigVector; +typedef std::vector ConfigVector; extern ConfigVector TheConfig; diff --git a/src/auth/Scheme.cc b/src/auth/Scheme.cc index bce72370c4..996f1908d1 100644 --- a/src/auth/Scheme.cc +++ b/src/auth/Scheme.cc @@ -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 @@ Auth::Scheme::Find(const char *typestr) return Auth::Scheme::Pointer(NULL); } -Vector & +std::vector & Auth::Scheme::GetSchemes() { if (!_Schemes) - _Schemes = new Vector; + _Schemes = new std::vector; return *_Schemes; } diff --git a/src/auth/Scheme.h b/src/auth/Scheme.h index f5d22fa01f..19d592a375 100644 --- a/src/auth/Scheme.h +++ b/src/auth/Scheme.h @@ -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 @@ class Scheme : public RefCountable { 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 @@ public: 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 diff --git a/src/comm/AcceptLimiter.cc b/src/comm/AcceptLimiter.cc index 7af4beaaf8..6e144f9308 100644 --- a/src/comm/AcceptLimiter.cc +++ b/src/comm/AcceptLimiter.cc @@ -47,7 +47,8 @@ Comm::AcceptLimiter::kick() 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; diff --git a/src/comm/AcceptLimiter.h b/src/comm/AcceptLimiter.h index 50689efaed..d6c28f3cb6 100644 --- a/src/comm/AcceptLimiter.h +++ b/src/comm/AcceptLimiter.h @@ -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 @@ namespace Comm * 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 @@ private: static AcceptLimiter Instance_; /** FIFO queue */ - Vector deferred_; + std::vector deferred_; }; }; // namepace Comm diff --git a/src/comm/forward.h b/src/comm/forward.h index 711c546814..caa4e2c6b8 100644 --- a/src/comm/forward.h +++ b/src/comm/forward.h @@ -2,7 +2,8 @@ #define _SQUID_COMM_FORWARD_H #include "base/RefCount.h" -#include "base/Vector.h" + +#include namespace Comm { @@ -11,7 +12,7 @@ class Connection; typedef RefCount ConnectionPointer; -typedef Vector ConnectionList; +typedef std::vector ConnectionList; bool IsConnOpen(const Comm::ConnectionPointer &conn); diff --git a/src/esi/VarState.h b/src/esi/VarState.h index 7a00daf244..87b4b53ef6 100644 --- a/src/esi/VarState.h +++ b/src/esi/VarState.h @@ -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 @@ private: void doIt (); void setupUserAgent(); Trie variables; - Vector variablesForCleanup; + std::vector variablesForCleanup; Variable *defaultVariable; }; diff --git a/src/tests/stub_DiskIOModule.cc b/src/tests/stub_DiskIOModule.cc index 457726bc7b..c3136e0bab 100644 --- a/src/tests/stub_DiskIOModule.cc +++ b/src/tests/stub_DiskIOModule.cc @@ -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) diff --git a/src/tests/stub_libauth.cc b/src/tests/stub_libauth.cc index a14c3151b7..accf8e90dc 100644 --- a/src/tests/stub_libauth.cc +++ b/src/tests/stub_libauth.cc @@ -21,10 +21,11 @@ AuthUserHashPointer::AuthUserHashPointer(Auth::User::Pointer anAuth_user) STUB 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"