This is an automated email from the ASF dual-hosted git repository.

maskit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new b6c0e55  Getting rid of ts::Vec implementation and replacing it with 
std::vector
b6c0e55 is described below

commit b6c0e55a0afb2583f8796fad4833956c3a3cea39
Author: IvanStarodubtsev <webdrive...@users.noreply.github.com>
AuthorDate: Thu Sep 14 18:03:52 2017 +0300

    Getting rid of ts::Vec implementation and replacing it with std::vector
    
    ts::Vec now used only within ts::Map - the rest of source code is free of it
---
 cmd/traffic_manager/metrics.cc            | 12 +++----
 configure.ac                              |  3 ++
 iocore/hostdb/P_RefCountCache.h           |  7 ++--
 iocore/hostdb/P_RefCountCacheSerializer.h | 10 +++---
 iocore/net/SSLUtils.cc                    | 29 ++++++++-------
 lib/records/I_RecHttp.h                   | 30 ++++++++--------
 lib/records/RecHttp.cc                    | 34 ++++++++----------
 lib/ts/PriorityQueue.h                    | 45 +++++++++++++----------
 lib/ts/test_PriorityQueue.cc              |  4 +--
 mgmt/FileManager.cc                       | 31 ++++++++++------
 mgmt/LocalManager.cc                      |  8 ++---
 mgmt/api/CoreAPI.cc                       |  8 +++--
 proxy/ControlBase.cc                      | 19 +++++-----
 proxy/ControlBase.h                       |  4 +--
 proxy/IPAllow.cc                          |  6 ++--
 proxy/IPAllow.h                           |  6 ++--
 proxy/InkAPI.cc                           |  2 +-
 proxy/InkAPITest.cc                       |  6 ++--
 proxy/InkAPITestTool.cc                   |  2 +-
 proxy/http/HttpProxyServerMain.cc         | 14 +++++---
 proxy/http2/HPACK.cc                      | 20 +++++------
 proxy/http2/HPACK.h                       |  5 +--
 proxy/logging/LogObject.cc                | 60 +++++++++++++++++--------------
 proxy/logging/LogObject.h                 |  8 ++---
 24 files changed, 203 insertions(+), 170 deletions(-)

diff --git a/cmd/traffic_manager/metrics.cc b/cmd/traffic_manager/metrics.cc
index b4d0838..04c30e8 100644
--- a/cmd/traffic_manager/metrics.cc
+++ b/cmd/traffic_manager/metrics.cc
@@ -22,11 +22,11 @@
  */
 
 #include <cmath>
+#include <vector>
 
 #include "ts/ink_config.h"
 #include "ts/ink_memory.h"
 #include "ts/Ptr.h"
-#include "ts/Vec.h"
 #include "ts/I_Layout.h"
 #include "bindings/bindings.h"
 #include "bindings/metrics.h"
@@ -146,7 +146,7 @@ struct EvaluatorList {
   EvaluatorList() : update(true), passes(0) {}
   ~EvaluatorList()
   {
-    forv_Vec (Evaluator, e, this->evaluators) {
+    for (auto &e : this->evaluators) {
       delete e;
     }
   }
@@ -163,7 +163,7 @@ struct EvaluatorList {
   void
   unbind(lua_State *L) const
   {
-    forv_Vec (Evaluator, e, this->evaluators) {
+    for (auto &e : this->evaluators) {
       e->unbind(L);
     }
   }
@@ -174,17 +174,17 @@ struct EvaluatorList {
     ink_hrtime start = ink_get_hrtime_internal();
     ink_hrtime elapsed;
 
-    forv_Vec (Evaluator, e, this->evaluators) {
+    for (auto &e : this->evaluators) {
       e->eval(L);
     }
 
     elapsed = ink_hrtime_diff(ink_get_hrtime_internal(), start);
-    Debug("lua", "evaluated %u metrics in %fmsec", evaluators.length(), 
ink_hrtime_to_usec(elapsed) / 1000.0);
+    Debug("lua", "evaluated %lu metrics in %fmsec", evaluators.size(), 
ink_hrtime_to_usec(elapsed) / 1000.0);
   }
 
   bool update;
   int64_t passes;
-  Vec<Evaluator *> evaluators;
+  std::vector<Evaluator *> evaluators;
 };
 
 static int
diff --git a/configure.ac b/configure.ac
index fcf61b2..fd720d0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -639,6 +639,9 @@ case $host_os in
     host_os_def="freebsd"
     AM_LDFLAGS="-rdynamic"
     TS_ADDTO(AM_CPPFLAGS, [-I/usr/local/include])
+    TS_ADDTO(AM_CPPFLAGS, [-D_GLIBCXX_USE_C99])
+    TS_ADDTO(AM_CPPFLAGS, [-D_GLIBCXX_USE_C99_MATH])
+    TS_ADDTO(AM_CPPFLAGS, [-D_GLIBCXX_USE_C99_MATH_TR1])
     ;;
   kfreebsd*)
     host_os_def="freebsd"
diff --git a/iocore/hostdb/P_RefCountCache.h b/iocore/hostdb/P_RefCountCache.h
index 4b7998e..346f9ea 100644
--- a/iocore/hostdb/P_RefCountCache.h
+++ b/iocore/hostdb/P_RefCountCache.h
@@ -32,7 +32,6 @@
 #include <ts/List.h>
 #include <ts/ink_hrtime.h>
 
-#include <ts/Vec.h>
 #include <ts/I_Version.h>
 #include <unistd.h>
 
@@ -154,7 +153,7 @@ public:
   template <class Iterator> void dealloc_entry(Iterator ptr);
 
   size_t count() const;
-  void copy(Vec<RefCountCacheHashEntry *> &items);
+  void copy(std::vector<RefCountCacheHashEntry *> &items);
 
   typedef typename TSHashTable<RefCountCacheHashing>::iterator iterator_type;
   typedef typename TSHashTable<RefCountCacheHashing>::self hash_type;
@@ -339,7 +338,7 @@ RefCountCachePartition<C>::count() const
 
 template <class C>
 void
-RefCountCachePartition<C>::copy(Vec<RefCountCacheHashEntry *> &items)
+RefCountCachePartition<C>::copy(std::vector<RefCountCacheHashEntry *> &items)
 {
   for (RefCountCachePartition<C>::iterator_type i = this->item_map.begin(); i 
!= this->item_map.end(); ++i) {
     RefCountCacheHashEntry *val = RefCountCacheHashEntry::alloc();
@@ -419,7 +418,7 @@ private:
   int max_size;  // Total size
   int max_items; // Total number of items allowed
   unsigned int num_partitions;
-  Vec<RefCountCachePartition<C> *> partitions;
+  std::vector<RefCountCachePartition<C> *> partitions;
   // Header
   RefCountCacheHeader header; // Our header
   RecRawStatBlock *rsb;
diff --git a/iocore/hostdb/P_RefCountCacheSerializer.h 
b/iocore/hostdb/P_RefCountCacheSerializer.h
index 853fd4e..a222817 100644
--- a/iocore/hostdb/P_RefCountCacheSerializer.h
+++ b/iocore/hostdb/P_RefCountCacheSerializer.h
@@ -26,6 +26,8 @@
 
 #include "P_RefCountCache.h"
 
+#include <vector>
+
 // This continuation is responsible for persisting RefCountCache to disk
 // To avoid locking the partitions for a long time we'll do the following 
per-partition:
 //    - lock
@@ -59,7 +61,7 @@ public:
   ~RefCountCacheSerializer();
 
 private:
-  Vec<RefCountCacheHashEntry *> partition_items;
+  std::vector<RefCountCacheHashEntry *> partition_items;
 
   int fd; // fd for the file we are writing to
 
@@ -107,7 +109,7 @@ template <class C> 
RefCountCacheSerializer<C>::~RefCountCacheSerializer()
     socketManager.close(fd);
   }
 
-  forv_Vec (RefCountCacheHashEntry, entry, this->partition_items) {
+  for (auto &entry : this->partition_items) {
     RefCountCacheHashEntry::free<C>(entry);
   }
   this->partition_items.clear();
@@ -157,7 +159,7 @@ RefCountCacheSerializer<C>::write_partition(int /* event 
*/, Event *e)
   // for item in this->partitionItems
   // write to disk with headers per item
 
-  for (unsigned int i = 0; i < this->partition_items.length(); i++) {
+  for (unsigned int i = 0; i < this->partition_items.size(); i++) {
     RefCountCacheHashEntry *entry = this->partition_items[i];
 
     // check if the item has expired, if so don't persist it to disk
@@ -186,7 +188,7 @@ RefCountCacheSerializer<C>::write_partition(int /* event 
*/, Event *e)
   }
 
   // Clear the copied partition for the next round.
-  forv_Vec (RefCountCacheHashEntry, entry, this->partition_items) {
+  for (auto &entry : this->partition_items) {
     RefCountCacheHashEntry::free<C>(entry);
   }
   this->partition_items.clear();
diff --git a/iocore/net/SSLUtils.cc b/iocore/net/SSLUtils.cc
index 880b9c2..dffe016 100644
--- a/iocore/net/SSLUtils.cc
+++ b/iocore/net/SSLUtils.cc
@@ -41,7 +41,7 @@
 #include <openssl/bn.h>
 #include <unistd.h>
 #include <termios.h>
-#include "ts/Vec.h"
+#include <vector>
 
 #if HAVE_OPENSSL_EVP_H
 #include <openssl/evp.h>
@@ -1473,7 +1473,7 @@ ssl_set_handshake_callbacks(SSL_CTX *ctx)
 }
 
 SSL_CTX *
-SSLInitServerContext(const SSLConfigParams *params, const ssl_user_config 
*sslMultCertSettings, Vec<X509 *> &certList)
+SSLInitServerContext(const SSLConfigParams *params, const ssl_user_config 
*sslMultCertSettings, std::vector<X509 *> &certList)
 {
   int server_verify_client;
   ats_scoped_str completeServerCertPath;
@@ -1782,9 +1782,8 @@ fail:
     EVP_MD_CTX_free(digest);
   SSL_CLEAR_PW_REFERENCES(ctx)
   SSLReleaseContext(ctx);
-  for (unsigned int i = 0; i < certList.length(); i++) {
-    X509_free(certList[i]);
-  }
+  for (auto cert : certList)
+    X509_free(cert);
 
   return nullptr;
 }
@@ -1792,16 +1791,16 @@ fail:
 SSL_CTX *
 SSLCreateServerContext(const SSLConfigParams *params)
 {
-  Vec<X509 *> cert_list;
+  std::vector<X509 *> cert_list;
   SSL_CTX *ctx = SSLInitServerContext(params, nullptr, cert_list);
-  ink_assert(cert_list.length() == 0);
+  ink_assert(cert_list.empty());
   return ctx;
 }
 
 static SSL_CTX *
 ssl_store_ssl_context(const SSLConfigParams *params, SSLCertLookup *lookup, 
const ssl_user_config *sslMultCertSettings)
 {
-  Vec<X509 *> cert_list;
+  std::vector<X509 *> cert_list;
   SSL_CTX *ctx                   = SSLInitServerContext(params, 
sslMultCertSettings, cert_list);
   ssl_ticket_key_block *keyblock = nullptr;
   bool inserted                  = false;
@@ -1812,8 +1811,8 @@ ssl_store_ssl_context(const SSLConfigParams *params, 
SSLCertLookup *lookup, cons
   }
 
   const char *certname = sslMultCertSettings->cert.get();
-  for (unsigned i = 0; i < cert_list.length(); ++i) {
-    if (0 > SSLCheckServerCertNow(cert_list[i], certname)) {
+  for (auto cert : cert_list) {
+    if (0 > SSLCheckServerCertNow(cert, certname)) {
       /* At this point, we know cert is bad, and we've already printed a
          descriptive reason as to why cert is bad to the log file */
       Debug("ssl", "Marking certificate as NOT VALID: %s", certname);
@@ -1868,8 +1867,8 @@ ssl_store_ssl_context(const SSLConfigParams *params, 
SSLCertLookup *lookup, cons
   if (SSLConfigParams::ssl_ocsp_enabled) {
     Debug("ssl", "ssl ocsp stapling is enabled");
     SSL_CTX_set_tlsext_status_cb(ctx, ssl_callback_ocsp_stapling);
-    for (unsigned i = 0; i < cert_list.length(); ++i) {
-      if (!ssl_stapling_init_cert(ctx, cert_list[i], certname)) {
+    for (auto cert : cert_list) {
+      if (!ssl_stapling_init_cert(ctx, cert, certname)) {
         Warning("fail to configure SSL_CTX for OCSP Stapling info for 
certificate at %s", (const char *)certname);
       }
     }
@@ -1886,8 +1885,8 @@ ssl_store_ssl_context(const SSLConfigParams *params, 
SSLCertLookup *lookup, cons
   // this code is updated to reconfigure the SSL certificates, it will need 
some sort of
   // refcounting or alternate way of avoiding double frees.
   Debug("ssl", "importing SNI names from %s", (const char *)certname);
-  for (unsigned i = 0; i < cert_list.length(); ++i) {
-    if (ssl_index_certificate(lookup, SSLCertContext(ctx, 
sslMultCertSettings->opt), cert_list[i], certname)) {
+  for (auto cert : cert_list) {
+    if (ssl_index_certificate(lookup, SSLCertContext(ctx, 
sslMultCertSettings->opt), cert, certname)) {
       inserted = true;
     }
   }
@@ -1903,7 +1902,7 @@ ssl_store_ssl_context(const SSLConfigParams *params, 
SSLCertLookup *lookup, cons
     ctx = nullptr;
   }
 
-  for (unsigned int i = 0; i < cert_list.length(); i++) {
+  for (unsigned int i = 0; i < cert_list.size(); i++) {
     X509_free(cert_list[i]);
   }
 
diff --git a/lib/records/I_RecHttp.h b/lib/records/I_RecHttp.h
index 75ddd6f..a3655f0 100644
--- a/lib/records/I_RecHttp.h
+++ b/lib/records/I_RecHttp.h
@@ -27,8 +27,10 @@
 #include <ts/ink_inet.h>
 #include <ts/ink_resolver.h>
 #include <ts/apidefs.h>
-#include <ts/Vec.h>
 #include <ts/apidefs.h>
+#include <ts/ink_assert.h>
+#include <algorithm>
+#include <vector>
 
 /// Load default inbound IP addresses from the configuration file.
 void RecHttpLoadIp(const char *name, ///< Name of value in configuration file.
@@ -222,7 +224,7 @@ private:
   typedef HttpProxyPort self; ///< Self reference type.
 public:
   /// Explicitly supported collection of proxy ports.
-  typedef Vec<self> Group;
+  typedef std::vector<self> Group;
 
   /// Type of transport on the connection.
   enum TransportType {
@@ -287,7 +289,7 @@ public:
       This is provided because most of the work with this data is used as a 
singleton
       and it's handy to encapsulate it here.
   */
-  static Vec<self> &global();
+  static std::vector<self> &global();
 
   /// Check for SSL ports.
   /// @return @c true if any port in @a ports is an SSL port.
@@ -307,7 +309,7 @@ public:
       @return @c true if at least one valid port description was
       found, @c false if none.
   */
-  static bool loadConfig(Vec<self> &ports ///< Destination for found port data.
+  static bool loadConfig(std::vector<self> &ports ///< Destination for found 
port data.
                          );
 
   /** Load all relevant configuration data into the global ports.
@@ -325,8 +327,8 @@ public:
       @note This is used primarily internally but is available if needed.
       @return @c true if a valid port was found, @c false if none.
   */
-  static bool loadValue(Vec<self> &ports, ///< Destination for found port data.
-                        const char *value ///< Source port data.
+  static bool loadValue(std::vector<self> &ports, ///< Destination for found 
port data.
+                        const char *value         ///< Source port data.
                         );
 
   /** Load ports from a value string into the global ports.
@@ -341,7 +343,7 @@ public:
 
   /// Load default value if @a ports is empty.
   /// @return @c true if the default was needed / loaded.
-  static bool loadDefaultIfEmpty(Vec<self> &ports ///< Load target.
+  static bool loadDefaultIfEmpty(std::vector<self> &ports ///< Load target.
                                  );
 
   /// Load default value into the global set if it is empty.
@@ -353,16 +355,16 @@ public:
       are checked.
       @return The port if found, @c nullptr if not.
   */
-  static self *findHttp(Group const &ports,         ///< Group to search.
-                        uint16_t family = AF_UNSPEC ///< Desired address 
family.
-                        );
+  static const self *findHttp(Group const &ports,         ///< Group to search.
+                              uint16_t family = AF_UNSPEC ///< Desired address 
family.
+                              );
 
   /** Find an HTTP port in the global ports.
       If @a family is specified then only ports for that family
       are checked.
       @return The port if found, @c nullptr if not.
   */
-  static self *findHttp(uint16_t family = AF_UNSPEC);
+  static const self *findHttp(uint16_t family = AF_UNSPEC);
 
   /** Create text description to be used for inter-process access.
       Prints the file descriptor and then any options.
@@ -395,7 +397,7 @@ public:
   static const char *const OPT_HOST_RES_PREFIX;         ///< Set DNS family 
preference.
   static const char *const OPT_PROTO_PREFIX;            ///< Transport layer 
protocols.
 
-  static Vec<self> &m_global; ///< Global ("default") data.
+  static std::vector<self> &m_global; ///< Global ("default") data.
 
 protected:
   /// Process @a value for DNS resolution family preferences.
@@ -453,7 +455,7 @@ HttpProxyPort::loadDefaultIfEmpty()
 {
   return self::loadDefaultIfEmpty(m_global);
 }
-inline Vec<HttpProxyPort> &
+inline std::vector<HttpProxyPort> &
 HttpProxyPort::global()
 {
   return m_global;
@@ -463,7 +465,7 @@ HttpProxyPort::hasSSL()
 {
   return self::hasSSL(m_global);
 }
-inline HttpProxyPort *
+inline const HttpProxyPort *
 HttpProxyPort::findHttp(uint16_t family)
 {
   return self::findHttp(m_global, family);
diff --git a/lib/records/RecHttp.cc b/lib/records/RecHttp.cc
index e480c51..b35cae2 100644
--- a/lib/records/RecHttp.cc
+++ b/lib/records/RecHttp.cc
@@ -168,22 +168,16 @@ HttpProxyPort::HttpProxyPort()
 bool
 HttpProxyPort::hasSSL(Group const &ports)
 {
-  bool zret = false;
-  for (int i = 0, n = ports.length(); i < n && !zret; ++i) {
-    if (ports[i].isSSL()) {
-      zret = true;
-    }
-  }
-  return zret;
+  return std::any_of(ports.begin(), ports.end(), [](HttpProxyPort const &port) 
{ return port.isSSL(); });
 }
 
-HttpProxyPort *
+const HttpProxyPort *
 HttpProxyPort::findHttp(Group const &ports, uint16_t family)
 {
   bool check_family_p = ats_is_ip(family);
-  self *zret          = nullptr;
-  for (int i = 0, n = ports.length(); i < n && !zret; ++i) {
-    HttpProxyPort &p = ports[i];
+  const self *zret    = nullptr;
+  for (int i = 0, n = ports.size(); i < n && !zret; ++i) {
+    const self &p = ports[i];
     if (p.m_port &&                               // has a valid port
         TRANSPORT_DEFAULT == p.m_type &&          // is normal HTTP
         (!check_family_p || p.m_family == family) // right address family
@@ -209,7 +203,7 @@ HttpProxyPort::checkPrefix(const char *src, char const 
*prefix, size_t prefix_le
 }
 
 bool
-HttpProxyPort::loadConfig(Vec<self> &entries)
+HttpProxyPort::loadConfig(std::vector<self> &entries)
 {
   char *text;
   bool found_p;
@@ -220,23 +214,23 @@ HttpProxyPort::loadConfig(Vec<self> &entries)
   }
   ats_free(text);
 
-  return 0 < entries.length();
+  return 0 < entries.size();
 }
 
 bool
 HttpProxyPort::loadDefaultIfEmpty(Group &ports)
 {
-  if (0 == ports.length()) {
+  if (0 == ports.size()) {
     self::loadValue(ports, DEFAULT_VALUE);
   }
 
-  return 0 < ports.length();
+  return 0 < ports.size();
 }
 
 bool
-HttpProxyPort::loadValue(Vec<self> &ports, const char *text)
+HttpProxyPort::loadValue(std::vector<self> &ports, const char *text)
 {
-  unsigned old_port_length = ports.length(); // remember this.
+  unsigned old_port_length = ports.size(); // remember this.
   if (text && *text) {
     Tokenizer tokens(", ");
     int n_ports = tokens.Initialize(text);
@@ -252,7 +246,7 @@ HttpProxyPort::loadValue(Vec<self> &ports, const char *text)
       }
     }
   }
-  return ports.length() > old_port_length; // we added at least one port.
+  return ports.size() > old_port_length; // we added at least one port.
 }
 
 bool
@@ -265,7 +259,7 @@ HttpProxyPort::processOptions(const char *opts)
   bool bracket_p      = false; // found an open bracket in the input?
   const char *value;           // Temp holder for value of a prefix option.
   IpAddr ip;                   // temp for loading IP addresses.
-  Vec<char *> values;          // Pointers to single option values.
+  std::vector<char *> values;  // Pointers to single option values.
 
   // Make a copy we can modify safely.
   size_t opts_len = strlen(opts) + 1;
@@ -297,7 +291,7 @@ HttpProxyPort::processOptions(const char *opts)
     return zret;
   }
 
-  for (int i = 0, n_items = values.length(); i < n_items; ++i) {
+  for (int i = 0, n_items = values.size(); i < n_items; ++i) {
     const char *item = values[i];
     if (isdigit(item[0])) { // leading digit -> port value
       char *ptr;
diff --git a/lib/ts/PriorityQueue.h b/lib/ts/PriorityQueue.h
index 06ea052..0f43496 100644
--- a/lib/ts/PriorityQueue.h
+++ b/lib/ts/PriorityQueue.h
@@ -25,7 +25,8 @@
 #define __PRIORITY_QUEUE_H__
 
 #include "ts/ink_assert.h"
-#include "ts/Vec.h"
+#include <vector>
+#include <algorithm>
 
 template <typename T> struct PriorityQueueEntry {
   PriorityQueueEntry(T n) : index(0), node(n){};
@@ -55,10 +56,10 @@ public:
   void update(PriorityQueueEntry<T> *);
   void update(PriorityQueueEntry<T> *, bool);
   void erase(PriorityQueueEntry<T> *);
-  const Vec<PriorityQueueEntry<T> *> &dump() const;
+  const std::vector<PriorityQueueEntry<T> *> &dump() const;
 
 private:
-  Vec<PriorityQueueEntry<T> *> _v;
+  std::vector<PriorityQueueEntry<T> *> _v;
 
   void _swap(uint32_t, uint32_t);
   void _bubble_up(uint32_t);
@@ -66,7 +67,7 @@ private:
 };
 
 template <typename T, typename Comp>
-const Vec<PriorityQueueEntry<T> *> &
+const std::vector<PriorityQueueEntry<T> *> &
 PriorityQueue<T, Comp>::dump() const
 {
   return _v;
@@ -76,14 +77,20 @@ template <typename T, typename Comp>
 bool
 PriorityQueue<T, Comp>::in(PriorityQueueEntry<T> *entry)
 {
-  return _v.in(entry) != NULL;
+  ink_release_assert(entry != NULL);
+
+  if (std::find(_v.begin(), _v.end(), entry) != _v.end()) {
+    return true;
+  }
+
+  return false;
 }
 
 template <typename T, typename Comp>
 bool
 PriorityQueue<T, Comp>::empty()
 {
-  return _v.length() == 0;
+  return _v.empty();
 }
 
 template <typename T, typename Comp>
@@ -92,7 +99,7 @@ PriorityQueue<T, Comp>::push(PriorityQueueEntry<T> *entry)
 {
   ink_release_assert(entry != NULL);
 
-  int len = _v.length();
+  int len = _v.size();
   _v.push_back(entry);
   entry->index = len;
 
@@ -119,9 +126,9 @@ PriorityQueue<T, Comp>::pop()
   }
 
   const uint32_t original_index = _v[0]->index;
-  _swap(0, _v.length() - 1);
-  _v[_v.length() - 1]->index = original_index;
-  _v.pop();
+  _swap(0, _v.size() - 1);
+  _v[_v.size() - 1]->index = original_index;
+  _v.pop_back();
   _bubble_down(0);
 }
 
@@ -135,22 +142,22 @@ PriorityQueue<T, Comp>::erase(PriorityQueueEntry<T> 
*entry)
 
   // If the entry doesn't belong to this queue just return.
   if (entry != _v[entry->index]) {
-    ink_assert(!_v.in(entry));
+    ink_assert(!in(entry));
     return;
   }
 
-  ink_release_assert(entry->index < _v.length());
+  ink_release_assert(entry->index < _v.size());
   const uint32_t original_index = entry->index;
-  if (original_index != (_v.length() - 1)) {
+  if (original_index != (_v.size() - 1)) {
     // Move the erased item to the end to be popped off
-    _swap(original_index, _v.length() - 1);
+    _swap(original_index, _v.size() - 1);
     // Fix the index before we pop it
-    _v[_v.length() - 1]->index = original_index;
-    _v.pop();
+    _v[_v.size() - 1]->index = original_index;
+    _v.pop_back();
     _bubble_down(original_index);
     _bubble_up(original_index);
   } else { // Otherwise, we are already at the end, just pop
-    _v.pop();
+    _v.pop_back();
   }
 }
 
@@ -235,9 +242,9 @@ PriorityQueue<T, Comp>::_bubble_down(uint32_t index)
   Comp comp;
 
   while (true) {
-    if ((left = index * 2 + 1) >= _v.length()) {
+    if ((left = index * 2 + 1) >= _v.size()) {
       break;
-    } else if ((right = index * 2 + 2) >= _v.length()) {
+    } else if ((right = index * 2 + 2) >= _v.size()) {
       smaller = left;
     } else {
       smaller = comp(_v[left]->node, _v[right]->node) ? left : right;
diff --git a/lib/ts/test_PriorityQueue.cc b/lib/ts/test_PriorityQueue.cc
index 6206c3c..2bdd635 100644
--- a/lib/ts/test_PriorityQueue.cc
+++ b/lib/ts/test_PriorityQueue.cc
@@ -52,9 +52,9 @@ using PQ    = PriorityQueue<N *>;
 void
 dump(PQ *pq)
 {
-  Vec<Entry *> v = pq->dump();
+  std::vector<Entry *> v = pq->dump();
 
-  for (uint32_t i = 0; i < v.length(); i++) {
+  for (uint32_t i = 0; i < v.size(); i++) {
     cout << v[i]->index << "," << v[i]->node->weight << "," << 
v[i]->node->content << endl;
   }
   cout << "--------" << endl;
diff --git a/mgmt/FileManager.cc b/mgmt/FileManager.cc
index dd6a28b..23fb028 100644
--- a/mgmt/FileManager.cc
+++ b/mgmt/FileManager.cc
@@ -24,7 +24,6 @@
 #include "ts/ink_platform.h"
 #include "ts/ink_file.h"
 #include "ts/I_Layout.h"
-#include "ts/Vec.h"
 #include "FileManager.h"
 #include "Main.h"
 #include "Rollback.h"
@@ -33,6 +32,9 @@
 #include "ExpandingArray.h"
 #include "MgmtSocket.h"
 
+#include <vector>
+#include <algorithm>
+
 #define DIR_MODE S_IRWXU
 #define FILE_MODE S_IRWXU
 
@@ -188,8 +190,9 @@ FileManager::rereadConfig()
   InkHashTableEntry *entry;
   InkHashTableIteratorState iterator_state;
 
-  Vec<Rollback *> changedFiles;
-  Vec<Rollback *> parentFileNeedChange;
+  std::vector<Rollback *> changedFiles;
+  std::vector<Rollback *> parentFileNeedChange;
+  size_t n;
   ink_mutex_acquire(&accessLock);
   for (entry = ink_hash_table_iterator_first(bindings, &iterator_state); entry 
!= nullptr;
        entry = ink_hash_table_iterator_next(bindings, &iterator_state)) {
@@ -197,13 +200,17 @@ FileManager::rereadConfig()
     if (rb->checkForUserUpdate(rb->isVersioned() ? ROLLBACK_CHECK_AND_UPDATE : 
ROLLBACK_CHECK_ONLY)) {
       changedFiles.push_back(rb);
       if (rb->isChildRollback()) {
-        parentFileNeedChange.add_exclusive(rb->getParentRollback());
+        if (std::find(parentFileNeedChange.begin(), 
parentFileNeedChange.end(), rb->getParentRollback()) ==
+            parentFileNeedChange.end()) {
+          parentFileNeedChange.push_back(rb->getParentRollback());
+        }
       }
     }
   }
 
-  Vec<Rollback *> childFileNeedDelete;
-  for (size_t i = 0; i < changedFiles.n; i++) {
+  std::vector<Rollback *> childFileNeedDelete;
+  n = changedFiles.size();
+  for (size_t i = 0; i < n; i++) {
     if (changedFiles[i]->isChildRollback()) {
       continue;
     }
@@ -212,18 +219,22 @@ FileManager::rereadConfig()
          entry = ink_hash_table_iterator_next(bindings, &iterator_state)) {
       rb = (Rollback *)ink_hash_table_entry_value(bindings, entry);
       if (rb->getParentRollback() == changedFiles[i]) {
-        childFileNeedDelete.add_exclusive(rb);
+        if (std::find(childFileNeedDelete.begin(), childFileNeedDelete.end(), 
rb) == childFileNeedDelete.end()) {
+          childFileNeedDelete.push_back(rb);
+        }
       }
     }
   }
-  for (size_t i = 0; i < childFileNeedDelete.n; i++) {
+  n = childFileNeedDelete.size();
+  for (size_t i = 0; i < n; i++) {
     ink_hash_table_delete(bindings, childFileNeedDelete[i]->getFileName());
     delete childFileNeedDelete[i];
   }
   ink_mutex_release(&accessLock);
 
-  for (size_t i = 0; i < parentFileNeedChange.n; i++) {
-    if (!changedFiles.in(parentFileNeedChange[i])) {
+  n = parentFileNeedChange.size();
+  for (size_t i = 0; i < n; i++) {
+    if (std::find(changedFiles.begin(), changedFiles.end(), 
parentFileNeedChange[i]) == changedFiles.end()) {
       fileChanged(parentFileNeedChange[i]->getFileName(), true);
     }
   }
diff --git a/mgmt/LocalManager.cc b/mgmt/LocalManager.cc
index 687c965..e64a6b6 100644
--- a/mgmt/LocalManager.cc
+++ b/mgmt/LocalManager.cc
@@ -834,7 +834,7 @@ LocalManager::startProxy(const char *onetime_options)
 
     // Check if we need to pass down port/fd information to
     // traffic_server by seeing if there are any open ports.
-    for (int i = 0, limit = m_proxy_ports.length(); !open_ports_p && i < 
limit; ++i) {
+    for (int i = 0, limit = m_proxy_ports.size(); !open_ports_p && i < limit; 
++i) {
       if (ts::NO_FD != m_proxy_ports[i].m_fd) {
         open_ports_p = true;
       }
@@ -845,7 +845,7 @@ LocalManager::startProxy(const char *onetime_options)
       bool need_comma_p = false;
 
       ink_strlcat(real_proxy_options, " --httpport ", OPTIONS_SIZE);
-      for (int i = 0, limit = m_proxy_ports.length(); i < limit; ++i) {
+      for (int i = 0, limit = m_proxy_ports.size(); i < limit; ++i) {
         HttpProxyPort &p = m_proxy_ports[i];
         if (ts::NO_FD != p.m_fd) {
           if (need_comma_p) {
@@ -883,7 +883,7 @@ LocalManager::startProxy(const char *onetime_options)
 void
 LocalManager::closeProxyPorts()
 {
-  for (int i = 0, n = lmgmt->m_proxy_ports.length(); i < n; ++i) {
+  for (int i = 0, n = lmgmt->m_proxy_ports.size(); i < n; ++i) {
     HttpProxyPort &p = lmgmt->m_proxy_ports[i];
     if (ts::NO_FD != p.m_fd) {
       close_socket(p.m_fd);
@@ -903,7 +903,7 @@ LocalManager::listenForProxy()
   }
 
   // We are not already bound, bind the port
-  for (int i = 0, n = lmgmt->m_proxy_ports.length(); i < n; ++i) {
+  for (int i = 0, n = lmgmt->m_proxy_ports.size(); i < n; ++i) {
     HttpProxyPort &p = lmgmt->m_proxy_ports[i];
     if (ts::NO_FD == p.m_fd) {
       this->bindProxyPort(p);
diff --git a/mgmt/api/CoreAPI.cc b/mgmt/api/CoreAPI.cc
index 60c3036..a76c9d6 100644
--- a/mgmt/api/CoreAPI.cc
+++ b/mgmt/api/CoreAPI.cc
@@ -49,6 +49,8 @@
 #include "ts/I_Layout.h"
 #include "ts/ink_cap.h"
 
+#include <vector>
+
 // global variable
 static CallbackTable *local_event_callbacks;
 
@@ -209,7 +211,7 @@ Lerror:
 #include <sys/ptrace.h>
 #include <cxxabi.h>
 
-typedef Vec<pid_t> threadlist;
+typedef std::vector<pid_t> threadlist;
 
 static threadlist
 threads_for_process(pid_t proc)
@@ -338,9 +340,9 @@ ServerBacktrace(unsigned /* options */, char **trace)
   threadlist threads(threads_for_process(lmgmt->watched_process_pid));
   TextBuffer text(0);
 
-  Debug("backtrace", "tracing %zd threads for traffic_server PID %ld", 
threads.count(), (long)lmgmt->watched_process_pid);
+  Debug("backtrace", "tracing %zd threads for traffic_server PID %ld", 
threads.size(), (long)lmgmt->watched_process_pid);
 
-  for_Vec (pid_t, threadid, threads) {
+  for (auto threadid : threads) {
     Debug("backtrace", "tracing thread %ld", (long)threadid);
     // Get the thread name using /proc/PID/comm
     ats_scoped_fd fd;
diff --git a/proxy/ControlBase.cc b/proxy/ControlBase.cc
index 16df04a..47d9b27 100644
--- a/proxy/ControlBase.cc
+++ b/proxy/ControlBase.cc
@@ -40,10 +40,11 @@
 #include "HTTP.h"
 #include "ControlMatcher.h"
 #include "HdrUtils.h"
-#include "ts/Vec.h"
 
 #include <ts/TsBuffer.h>
 
+#include <vector>
+
 /** Used for printing IP address.
     @code
     uint32_t addr; // IP address.
@@ -436,7 +437,7 @@ TextMod::set(const char *value)
 }
 
 struct MultiTextMod : public ControlBase::Modifier {
-  Vec<ts::Buffer> text_vec;
+  std::vector<ts::Buffer> text_vec;
   MultiTextMod();
   ~MultiTextMod() override;
 
@@ -458,7 +459,7 @@ MultiTextMod::~MultiTextMod()
 void
 MultiTextMod::print(FILE *f) const
 {
-  for_Vec (ts::Buffer, text_iter, this->text_vec) {
+  for (auto text_iter : this->text_vec) {
     fprintf(f, "%s=%*s ", this->name(), static_cast<int>(text_iter.size()), 
text_iter.data());
   }
 }
@@ -585,12 +586,12 @@ SuffixMod::check(HttpRequestData *req) const
   int path_len;
   const char *path = req->hdr->url_get()->path_get(&path_len);
 
-  if (1 == static_cast<int>(this->text_vec.count()) && 1 == 
static_cast<int>(this->text_vec[0].size()) &&
+  if (1 == static_cast<int>(this->text_vec.size()) && 1 == 
static_cast<int>(this->text_vec[0].size()) &&
       0 == strcmp(this->text_vec[0].data(), "*")) {
     return true;
   }
 
-  for_Vec (ts::Buffer, text_iter, this->text_vec) {
+  for (auto text_iter : this->text_vec) {
     if (path_len >= static_cast<int>(text_iter.size()) &&
         0 == strncasecmp(path + path_len - text_iter.size(), text_iter.data(), 
text_iter.size())) {
       return true;
@@ -701,7 +702,7 @@ ControlBase::~ControlBase()
 void
 ControlBase::clear()
 {
-  _mods.delete_and_clear();
+  _mods.clear();
 }
 
 // static const modifier_el default_el = { MOD_INVALID, NULL };
@@ -709,7 +710,7 @@ ControlBase::clear()
 void
 ControlBase::Print()
 {
-  int n = _mods.length();
+  int n = _mods.size();
 
   if (0 >= n) {
     return;
@@ -754,7 +755,7 @@ ControlBase::CheckModifiers(HttpRequestData *request_data)
     return false;
   }
 
-  forv_Vec (Modifier, cur_mod, _mods) {
+  for (auto &cur_mod : _mods) {
     if (cur_mod && !cur_mod->check(request_data)) {
       return false;
     }
@@ -777,7 +778,7 @@ static const char *errorFormats[] = {
 ControlBase::Modifier *
 ControlBase::findModOfType(Modifier::Type t) const
 {
-  forv_Vec (Modifier, m, _mods) {
+  for (auto &m : _mods) {
     if (m && t == m->type()) {
       return m;
     }
diff --git a/proxy/ControlBase.h b/proxy/ControlBase.h
index 30ec91f..f78ae28 100644
--- a/proxy/ControlBase.h
+++ b/proxy/ControlBase.h
@@ -33,7 +33,7 @@
 #define _CONTROL_BASE_H_
 
 #include "ts/ink_platform.h"
-#include "ts/Vec.h"
+#include "vector"
 
 class HttpRequestData;
 class Tokenizer;
@@ -88,7 +88,7 @@ protected:
   const char *getSchemeModText() const;
 
 private:
-  typedef Vec<Modifier *> Array;
+  typedef std::vector<Modifier *> Array;
   Array _mods;
   const char *ProcessSrcIp(char *val, void **opaque_ptr);
   const char *ProcessTimeOfDay(char *val, void **opaque_ptr);
diff --git a/proxy/IPAllow.cc b/proxy/IPAllow.cc
index 82a0afa..8eaca0d 100644
--- a/proxy/IPAllow.cc
+++ b/proxy/IPAllow.cc
@@ -284,11 +284,11 @@ IpAllow::BuildTable()
           }
 
           if (method_found) {
-            Vec<AclRecord> &acls = is_dest_ip ? _dest_acls : _src_acls;
-            IpMap &map           = is_dest_ip ? _dest_map : _src_map;
+            std::vector<AclRecord> &acls = is_dest_ip ? _dest_acls : _src_acls;
+            IpMap &map                   = is_dest_ip ? _dest_map : _src_map;
             acls.push_back(AclRecord(acl_method_mask, line_num, 
nonstandard_methods, deny_nonstandard_methods));
             // Color with index in acls because at this point the address is 
volatile.
-            map.fill(&addr1, &addr2, reinterpret_cast<void *>(acls.length() - 
1));
+            map.fill(&addr1, &addr2, reinterpret_cast<void *>(acls.size() - 
1));
           } else {
             snprintf(errBuf, sizeof(errBuf), "%s discarding %s entry at line 
%d : %s", module_name, config_file_path, line_num,
                      "Invalid action/method specified"); // changed by YTS 
Team, yamsat bug id -59022
diff --git a/proxy/IPAllow.h b/proxy/IPAllow.h
index a0a6f8b..05023be 100644
--- a/proxy/IPAllow.h
+++ b/proxy/IPAllow.h
@@ -34,11 +34,11 @@
 #include "Main.h"
 #include "hdrs/HTTP.h"
 #include "ts/IpMap.h"
-#include "ts/Vec.h"
 #include "ProxyConfig.h"
 
 #include <string>
 #include <set>
+#include <vector>
 
 // forward declare in name only so it can be a friend.
 struct IpAllowUpdate;
@@ -168,8 +168,8 @@ private:
   const char *action;
   IpMap _src_map;
   IpMap _dest_map;
-  Vec<AclRecord> _src_acls;
-  Vec<AclRecord> _dest_acls;
+  std::vector<AclRecord> _src_acls;
+  std::vector<AclRecord> _dest_acls;
 };
 
 inline AclRecord *
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index 3c164e0..7c417a2 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -9007,7 +9007,7 @@ TSPluginDescriptorAccept(TSCont contp)
   Action *action = nullptr;
 
   HttpProxyPort::Group &proxy_ports = HttpProxyPort::global();
-  for (int i = 0, n = proxy_ports.length(); i < n; ++i) {
+  for (int i = 0, n = proxy_ports.size(); i < n; ++i) {
     HttpProxyPort &port = proxy_ports[i];
     if (port.isPlugin()) {
       NetProcessor::AcceptOptions net(make_net_accept_options(&port, -1 /* 
nthreads */));
diff --git a/proxy/InkAPITest.cc b/proxy/InkAPITest.cc
index bc97c62..bf5435f 100644
--- a/proxy/InkAPITest.cc
+++ b/proxy/InkAPITest.cc
@@ -2155,9 +2155,9 @@ static int
 checkHttpTxnIncomingAddrGet(SocketTest *test, void *data)
 {
   uint16_t port;
-  HttpProxyPort *proxy_port = HttpProxyPort::findHttp(AF_INET);
-  TSHttpTxn txnp            = (TSHttpTxn)data;
-  sockaddr const *ptr       = TSHttpTxnIncomingAddrGet(txnp);
+  const HttpProxyPort *proxy_port = HttpProxyPort::findHttp(AF_INET);
+  TSHttpTxn txnp                  = (TSHttpTxn)data;
+  sockaddr const *ptr             = TSHttpTxnIncomingAddrGet(txnp);
 
   if (nullptr == proxy_port) {
     SDK_RPRINT(test->regtest, "TSHttpTxnIncomingPortGet", "TestCase1", TC_FAIL,
diff --git a/proxy/InkAPITestTool.cc b/proxy/InkAPITestTool.cc
index fc3392a..f598e40 100644
--- a/proxy/InkAPITestTool.cc
+++ b/proxy/InkAPITestTool.cc
@@ -482,7 +482,7 @@ get_response_id(TSHttpTxn txnp)
 static ClientTxn *
 synclient_txn_create(void)
 {
-  HttpProxyPort *proxy_port;
+  const HttpProxyPort *proxy_port;
 
   ClientTxn *txn = (ClientTxn *)TSmalloc(sizeof(ClientTxn));
 
diff --git a/proxy/http/HttpProxyServerMain.cc 
b/proxy/http/HttpProxyServerMain.cc
index e88b604..df1200d 100644
--- a/proxy/http/HttpProxyServerMain.cc
+++ b/proxy/http/HttpProxyServerMain.cc
@@ -40,6 +40,8 @@
 #include "http2/Http2SessionAccept.h"
 #include "HttpConnectionCount.h"
 
+#include <vector>
+
 HttpSessionAccept *plugin_http_accept             = nullptr;
 HttpSessionAccept *plugin_http_transparent_accept = nullptr;
 
@@ -105,7 +107,7 @@ struct HttpProxyAcceptor {
     @c SSLNextProtocolAccept is a subclass of @c Cont instead of @c
     HttpAccept.
 */
-Vec<HttpProxyAcceptor> HttpProxyAcceptors;
+std::vector<HttpProxyAcceptor> HttpProxyAcceptors;
 
 // Called from InkAPI.cc
 NetProcessor::AcceptOptions
@@ -265,8 +267,10 @@ init_accept_HttpProxyServer(int n_accept_threads)
   }
 
   // Do the configuration defined ports.
-  for (int i = 0, n = proxy_ports.length(); i < n; ++i) {
-    MakeHttpProxyAcceptor(HttpProxyAcceptors.add(), proxy_ports[i], 
n_accept_threads);
+  // Assign temporary empty objects of proxy ports size
+  HttpProxyAcceptors.assign(proxy_ports.size(), HttpProxyAcceptor());
+  for (int i = 0, n = proxy_ports.size(); i < n; ++i) {
+    MakeHttpProxyAcceptor(HttpProxyAcceptors.at(i), proxy_ports[i], 
n_accept_threads);
   }
 }
 
@@ -281,9 +285,9 @@ start_HttpProxyServer()
   ///////////////////////////////////
 
   ink_assert(!called_once);
-  ink_assert(proxy_ports.length() == HttpProxyAcceptors.length());
+  ink_assert(proxy_ports.size() == HttpProxyAcceptors.size());
 
-  for (int i = 0, n = proxy_ports.length(); i < n; ++i) {
+  for (int i = 0, n = proxy_ports.size(); i < n; ++i) {
     HttpProxyAcceptor &acceptor = HttpProxyAcceptors[i];
     HttpProxyPort &port         = proxy_ports[i];
     if (port.isSSL()) {
diff --git a/proxy/http2/HPACK.cc b/proxy/http2/HPACK.cc
index 4bfa2f7..1c45d1e 100644
--- a/proxy/http2/HPACK.cc
+++ b/proxy/http2/HPACK.cc
@@ -219,9 +219,9 @@ HpackLookupResult
 HpackIndexingTable::lookup(const char *name, int name_len, const char *value, 
int value_len) const
 {
   HpackLookupResult result;
-  const int entry_num = TS_HPACK_STATIC_TABLE_ENTRY_NUM + 
_dynamic_table->length();
+  const unsigned int entry_num = TS_HPACK_STATIC_TABLE_ENTRY_NUM + 
_dynamic_table->length();
 
-  for (int index = 1; index < entry_num; ++index) {
+  for (unsigned int index = 1; index < entry_num; ++index) {
     const char *table_name, *table_value;
     int table_name_len = 0, table_value_len = 0;
 
@@ -321,7 +321,7 @@ HpackIndexingTable::update_maximum_size(uint32_t new_size)
 const MIMEField *
 HpackDynamicTable::get_header_field(uint32_t index) const
 {
-  return _headers.get(index);
+  return _headers.at(index);
 }
 
 void
@@ -344,13 +344,13 @@ HpackDynamicTable::add_header_field(const MIMEField 
*field)
     _current_size += header_size;
     while (_current_size > _maximum_size) {
       int last_name_len, last_value_len;
-      MIMEField *last_field = _headers.last();
+      MIMEField *last_field = _headers.back();
 
       last_field->name_get(&last_name_len);
       last_field->value_get(&last_value_len);
       _current_size -= ADDITIONAL_OCTETS + last_name_len + last_value_len;
 
-      _headers.remove_index(_headers.length() - 1);
+      _headers.erase(_headers.begin() + _headers.size() - 1);
       _mhdr->field_delete(last_field, false);
     }
 
@@ -358,7 +358,7 @@ HpackDynamicTable::add_header_field(const MIMEField *field)
     new_field->value_set(_mhdr->m_heap, _mhdr->m_mime, value, value_len);
     _mhdr->field_attach(new_field);
     // XXX Because entire Vec instance is copied, Its too expensive!
-    _headers.insert(0, new_field);
+    _headers.insert(_headers.begin(), new_field);
   }
 }
 
@@ -385,17 +385,17 @@ bool
 HpackDynamicTable::update_maximum_size(uint32_t new_size)
 {
   while (_current_size > new_size) {
-    if (_headers.n <= 0) {
+    if (_headers.size() <= 0) {
       return false;
     }
     int last_name_len, last_value_len;
-    MIMEField *last_field = _headers.last();
+    MIMEField *last_field = _headers.back();
 
     last_field->name_get(&last_name_len);
     last_field->value_get(&last_value_len);
     _current_size -= ADDITIONAL_OCTETS + last_name_len + last_value_len;
 
-    _headers.remove_index(_headers.length() - 1);
+    _headers.erase(_headers.begin() + _headers.size() - 1);
     _mhdr->field_delete(last_field, false);
   }
 
@@ -406,7 +406,7 @@ HpackDynamicTable::update_maximum_size(uint32_t new_size)
 uint32_t
 HpackDynamicTable::length() const
 {
-  return _headers.length();
+  return _headers.size();
 }
 
 //
diff --git a/proxy/http2/HPACK.h b/proxy/http2/HPACK.h
index 3d209e6..39191a7 100644
--- a/proxy/http2/HPACK.h
+++ b/proxy/http2/HPACK.h
@@ -25,10 +25,11 @@
 #define __HPACK_H__
 
 #include "ts/ink_platform.h"
-#include "ts/Vec.h"
 #include "ts/Diags.h"
 #include "HTTP.h"
 
+#include <vector>
+
 // It means that any header field can be compressed/decompressed by ATS
 const static int HPACK_ERROR_COMPRESSION_ERROR   = -1;
 const static int HPACK_ERROR_SIZE_EXCEEDED_ERROR = -2;
@@ -133,7 +134,7 @@ private:
   uint32_t _maximum_size;
 
   MIMEHdr *_mhdr;
-  Vec<MIMEField *> _headers;
+  std::vector<MIMEField *> _headers;
 };
 
 // [RFC 7541] 2.3. Indexing Table
diff --git a/proxy/logging/LogObject.cc b/proxy/logging/LogObject.cc
index 011d1ed..3d0cd8b 100644
--- a/proxy/logging/LogObject.cc
+++ b/proxy/logging/LogObject.cc
@@ -38,6 +38,9 @@
 #include "Log.h"
 #include "ts/TestBox.h"
 
+#include <algorithm>
+#include <vector>
+
 static bool
 should_roll_on_time(Log::RollingEnabledValues roll)
 {
@@ -857,13 +860,13 @@ LogObjectManager::LogObjectManager()
 
 LogObjectManager::~LogObjectManager()
 {
-  for (unsigned i = 0; i < _objects.length(); ++i) {
+  for (unsigned i = 0; i < _objects.size(); ++i) {
     if (REF_COUNT_OBJ_REFCOUNT_DEC(_objects[i]) == 0) {
       delete _objects[i];
     }
   }
 
-  for (unsigned i = 0; i < _APIobjects.length(); ++i) {
+  for (unsigned i = 0; i < _APIobjects.size(); ++i) {
     if (REF_COUNT_OBJ_REFCOUNT_DEC(_APIobjects[i]) == 0) {
       delete _APIobjects[i];
     }
@@ -1044,7 +1047,7 @@ LogObjectManager::_filename_resolution_abort(const char 
*filename)
 bool
 LogObjectManager::_has_internal_filename_conflict(const char *filename, 
LogObjectList &objects)
 {
-  for (unsigned i = 0; i < objects.length(); i++) {
+  for (unsigned i = 0; i < objects.size(); i++) {
     if (!objects[i]->is_collation_client()) {
       // an internal conflict exists if two objects request the
       // same filename, regardless of the object signatures, since
@@ -1085,7 +1088,7 @@ 
LogObjectManager::_solve_internal_filename_conflicts(LogObject *log_object, int
 LogObject *
 LogObjectManager::get_object_with_signature(uint64_t signature)
 {
-  for (unsigned i = 0; i < this->_objects.length(); i++) {
+  for (unsigned i = 0; i < this->_objects.size(); i++) {
     LogObject *obj = this->_objects[i];
 
     if (obj->get_signature() == signature) {
@@ -1098,13 +1101,13 @@ LogObjectManager::get_object_with_signature(uint64_t 
signature)
 void
 LogObjectManager::check_buffer_expiration(long time_now)
 {
-  for (unsigned i = 0; i < this->_objects.length(); i++) {
+  for (unsigned i = 0; i < this->_objects.size(); i++) {
     this->_objects[i]->check_buffer_expiration(time_now);
   }
 
   ACQUIRE_API_MUTEX("A LogObjectManager::check_buffer_expiration");
 
-  for (unsigned i = 0; i < this->_APIobjects.length(); i++) {
+  for (unsigned i = 0; i < this->_APIobjects.size(); i++) {
     this->_APIobjects[i]->check_buffer_expiration(time_now);
   }
 
@@ -1116,13 +1119,13 @@ LogObjectManager::preproc_buffers(int idx)
 {
   size_t buffers_preproced = 0;
 
-  for (unsigned i = 0; i < this->_objects.length(); i++) {
+  for (unsigned i = 0; i < this->_objects.size(); i++) {
     buffers_preproced += this->_objects[i]->preproc_buffers(idx);
   }
 
   ACQUIRE_API_MUTEX("A LogObjectManager::preproc_buffers");
 
-  for (unsigned i = 0; i < this->_APIobjects.length(); i++) {
+  for (unsigned i = 0; i < this->_APIobjects.size(); i++) {
     buffers_preproced += this->_APIobjects[i]->preproc_buffers(idx);
   }
 
@@ -1134,10 +1137,15 @@ LogObjectManager::preproc_buffers(int idx)
 bool
 LogObjectManager::unmanage_api_object(LogObject *logObject)
 {
+  if (!logObject)
+    return false;
+
   ACQUIRE_API_MUTEX("A LogObjectManager::unmanage_api_object");
 
-  if (this->_APIobjects.in(logObject)) {
-    this->_APIobjects.remove(logObject);
+  auto index = std::find(this->_APIobjects.begin(), this->_APIobjects.end(), 
logObject);
+
+  if (index != this->_APIobjects.end()) {
+    this->_APIobjects.erase(index);
 
     // Force a buffer flush, then schedule this LogObject to be deleted on the 
eventProcessor.
     logObject->force_new_buffer();
@@ -1154,7 +1162,7 @@ LogObjectManager::unmanage_api_object(LogObject 
*logObject)
 void
 LogObjectManager::add_filter_to_all(LogFilter *filter)
 {
-  for (unsigned i = 0; i < this->_objects.length(); i++) {
+  for (unsigned i = 0; i < this->_objects.size(); i++) {
     _objects[i]->add_filter(filter);
   }
 }
@@ -1165,7 +1173,7 @@ LogObjectManager::open_local_pipes()
   // for all local objects that write to a pipe, call open_file to force
   // the creation of the pipe so that any potential reader can see it
   //
-  for (unsigned i = 0; i < this->_objects.length(); i++) {
+  for (unsigned i = 0; i < this->_objects.size(); i++) {
     LogObject *obj = _objects[i];
     if (obj->writes_to_pipe() && !obj->is_collation_client()) {
       obj->m_logFile->open_file();
@@ -1182,22 +1190,22 @@ LogObjectManager::transfer_objects(LogObjectManager 
&old_mgr)
 
   if (is_debug_tag_set("log-config-transfer")) {
     Debug("log-config-transfer", "TRANSFER OBJECTS: list of old objects");
-    for (unsigned i = 0; i < old_mgr._objects.length(); i++) {
+    for (unsigned i = 0; i < old_mgr._objects.size(); i++) {
       Debug("log-config-transfer", "%s", 
old_mgr._objects[i]->get_original_filename());
     }
 
     Debug("log-config-transfer", "TRANSFER OBJECTS : list of new objects");
-    for (unsigned i = 0; i < this->_objects.length(); i++) {
+    for (unsigned i = 0; i < this->_objects.size(); i++) {
       Debug("log-config-transfer", "%s", _objects[i]->get_original_filename());
     }
   }
 
   // Transfer the API objects from the old manager. The old manager will 
retain its refcount.
-  for (unsigned i = 0; i < old_mgr._APIobjects.length(); ++i) {
+  for (unsigned i = 0; i < old_mgr._APIobjects.size(); ++i) {
     manage_api_object(old_mgr._APIobjects[i]);
   }
 
-  for (unsigned i = 0; i < old_mgr._objects.length(); ++i) {
+  for (unsigned i = 0; i < old_mgr._objects.size(); ++i) {
     LogObject *old_obj = old_mgr._objects[i];
     LogObject *new_obj;
 
@@ -1206,7 +1214,7 @@ LogObjectManager::transfer_objects(LogObjectManager 
&old_mgr)
     // See if any of the new objects is just a copy of an old one. If so, 
transfer the
     // old one to the new manager and delete the new one. We don't use Vec::in 
here because
     // we need to compare the object hash, not the pointers.
-    for (unsigned j = 0; j < _objects.length(); j++) {
+    for (unsigned j = 0; j < _objects.size(); j++) {
       new_obj = _objects[j];
 
       Debug("log-config-transfer", "comparing existing object %s to new object 
%s", old_obj->get_base_filename(),
@@ -1238,13 +1246,13 @@ LogObjectManager::roll_files(long time_now)
 {
   int num_rolled = 0;
 
-  for (unsigned i = 0; i < this->_objects.length(); i++) {
+  for (unsigned i = 0; i < this->_objects.size(); i++) {
     num_rolled += this->_objects[i]->roll_files(time_now);
   }
 
   ACQUIRE_API_MUTEX("A LogObjectManager::roll_files");
 
-  for (unsigned i = 0; i < this->_APIobjects.length(); i++) {
+  for (unsigned i = 0; i < this->_APIobjects.size(); i++) {
     num_rolled += this->_APIobjects[i]->roll_files(time_now);
   }
 
@@ -1256,12 +1264,12 @@ LogObjectManager::roll_files(long time_now)
 void
 LogObjectManager::display(FILE *str)
 {
-  for (unsigned i = 0; i < this->_objects.length(); i++) {
+  for (unsigned i = 0; i < this->_objects.size(); i++) {
     _objects[i]->display(str);
   }
 
   ACQUIRE_API_MUTEX("A LogObjectManager::display");
-  for (unsigned i = 0; i < this->_APIobjects.length(); i++) {
+  for (unsigned i = 0; i < this->_APIobjects.size(); i++) {
     _APIobjects[i]->display(str);
   }
   RELEASE_API_MUTEX("R LogObjectManager::display");
@@ -1270,7 +1278,7 @@ LogObjectManager::display(FILE *str)
 LogObject *
 LogObjectManager::find_by_format_name(const char *name) const
 {
-  for (unsigned i = 0; i < this->_objects.length(); ++i) {
+  for (unsigned i = 0; i < this->_objects.size(); ++i) {
     if (this->_objects[i] && this->_objects[i]->m_format->name_id() == 
LogFormat::id_from_name(name)) {
       return this->_objects[i];
     }
@@ -1283,7 +1291,7 @@ LogObjectManager::get_num_collation_clients() const
 {
   unsigned coll_clients = 0;
 
-  for (unsigned i = 0; i < this->_objects.length(); ++i) {
+  for (unsigned i = 0; i < this->_objects.size(); ++i) {
     if (this->_objects[i] && this->_objects[i]->is_collation_client()) {
       ++coll_clients;
     }
@@ -1297,7 +1305,7 @@ LogObjectManager::log(LogAccess *lad)
   int ret           = Log::SKIP;
   ProxyMutex *mutex = this_thread()->mutex.get();
 
-  for (unsigned i = 0; i < this->_objects.length(); i++) {
+  for (unsigned i = 0; i < this->_objects.size(); i++) {
     //
     // Auto created LogObject is only applied to LogBuffer
     // data received from network in collation host. It should
@@ -1335,13 +1343,13 @@ LogObjectManager::log(LogAccess *lad)
 void
 LogObjectManager::flush_all_objects()
 {
-  for (unsigned i = 0; i < this->_objects.length(); ++i) {
+  for (unsigned i = 0; i < this->_objects.size(); ++i) {
     this->_objects[i]->force_new_buffer();
   }
 
   ACQUIRE_API_MUTEX("A LogObjectManager::flush_all_objects");
 
-  for (unsigned i = 0; i < this->_APIobjects.length(); ++i) {
+  for (unsigned i = 0; i < this->_APIobjects.size(); ++i) {
     this->_APIobjects[i]->force_new_buffer();
   }
 
diff --git a/proxy/logging/LogObject.h b/proxy/logging/LogObject.h
index 1ca9010..b932002 100644
--- a/proxy/logging/LogObject.h
+++ b/proxy/logging/LogObject.h
@@ -33,7 +33,7 @@
 #include "LogBuffer.h"
 #include "LogAccess.h"
 #include "LogFilter.h"
-#include "ts/Vec.h"
+#include <vector>
 
 /*-------------------------------------------------------------------------
   LogObject
@@ -352,7 +352,7 @@ public:
   };
 
 private:
-  typedef Vec<LogObject *> LogObjectList;
+  typedef std::vector<LogObject *> LogObjectList;
 
   LogObjectList _objects;    // array of configured objects
   LogObjectList _APIobjects; // array of API objects
@@ -408,12 +408,12 @@ public:
   bool
   has_api_objects() const
   {
-    return _APIobjects.length() > 0;
+    return _APIobjects.size() > 0;
   }
   unsigned
   get_num_objects() const
   {
-    return _objects.length();
+    return _objects.size();
   }
   unsigned get_num_collation_clients() const;
 };

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].

Reply via email to