You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bc...@apache.org on 2020/05/06 17:44:38 UTC

[trafficserver] branch 7.1.x updated: Remove using namespace std

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

bcall pushed a commit to branch 7.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/7.1.x by this push:
     new e1abccf  Remove using namespace std
e1abccf is described below

commit e1abccfb28dffbaaaf7f57c7acf06583d0934d00
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Wed Nov 6 08:47:29 2019 +0900

    Remove using namespace std
    
    To fix build issue on FreeBSD 12.1 & LLVM-9 on macOS
    
    (cherry picked from commit e50520f4a4954ed8375e00594d86a11556e3d95c)
    
    Conflicts:
    	iocore/cache/CacheTest.cc
    	src/traffic_top/stats.h
---
 cmd/traffic_top/stats.h   | 13 ++++++++++---
 iocore/cache/CacheTest.cc |  4 +---
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/cmd/traffic_top/stats.h b/cmd/traffic_top/stats.h
index f35c163..8fdcc00 100644
--- a/cmd/traffic_top/stats.h
+++ b/cmd/traffic_top/stats.h
@@ -32,8 +32,6 @@
 #include <sys/time.h>
 #include "mgmtapi.h"
 
-using namespace std;
-
 struct LookupItem {
   LookupItem(const char *s, const char *n, const int t) : pretty(s), name(n), numerator(""), denominator(""), type(t) {}
   LookupItem(const char *s, const char *n, const char *d, const int t) : pretty(s), name(n), numerator(n), denominator(d), type(t)
@@ -49,7 +47,7 @@ extern size_t write_data(void *ptr, size_t size, size_t nmemb, void *stream);
 #if HAS_CURL
 extern char curl_error[CURL_ERROR_SIZE];
 #endif
-extern string response;
+extern std::string response;
 
 namespace constant
 {
@@ -62,6 +60,9 @@ const char end[]       = "\",\n";
 //----------------------------------------------------------------------------
 class Stats
 {
+  using string                            = std::string;
+  template <class Key, class T> using map = std::map<Key, T>;
+
 public:
   Stats(const string &url) : _url(url)
   {
@@ -494,6 +495,12 @@ public:
   }
 
 private:
+ std::pair<std::string, LookupItem>
+ make_pair(std::string s, LookupItem i)
+ {
+   return std::make_pair(s, i);
+ }
+
   map<string, string> *_stats;
   map<string, string> *_old_stats;
   map<string, LookupItem> lookup_table;
diff --git a/iocore/cache/CacheTest.cc b/iocore/cache/CacheTest.cc
index 3aca888..173f3c4 100644
--- a/iocore/cache/CacheTest.cc
+++ b/iocore/cache/CacheTest.cc
@@ -28,8 +28,6 @@
 #include <vector>
 #include <cmath>
 
-using namespace std;
-
 CacheTestSM::CacheTestSM(RegressionTest *t, const char *name)
   : RegressionSM(t),
     start_memcpy_on_clone(0),
@@ -546,7 +544,7 @@ test_RamCache(RegressionTest *t, RamCache *cache, const char *name, int64_t cach
   bool pass = true;
   CacheKey key;
   Vol *vol = theCache->key_to_vol(&key, "example.com", sizeof("example.com") - 1);
-  vector<Ptr<IOBufferData>> data;
+  std::vector<Ptr<IOBufferData>> data;
 
   cache->init(cache_size, vol);