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 2019/11/12 21:36:17 UTC
[trafficserver] branch 8.0.x updated: Remove using namespace std
This is an automated email from the ASF dual-hosted git repository.
bcall pushed a commit to branch 8.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/8.0.x by this push:
new 4772ab5 Remove using namespace std
4772ab5 is described below
commit 4772ab554f5ec3c6c97856e8d3a1e4d8c994c4a7
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)
---
iocore/cache/CacheTest.cc | 4 +---
src/traffic_top/stats.h | 13 ++++++++++---
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/iocore/cache/CacheTest.cc b/iocore/cache/CacheTest.cc
index 8231ac7..66b9b5d 100644
--- a/iocore/cache/CacheTest.cc
+++ b/iocore/cache/CacheTest.cc
@@ -28,8 +28,6 @@
#include <cmath>
#include <cstdlib>
-using namespace std;
-
CacheTestSM::CacheTestSM(RegressionTest *t, const char *name) : RegressionSM(t), cache_test_name(name)
{
SET_HANDLER(&CacheTestSM::event_handler);
@@ -550,7 +548,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);
diff --git a/src/traffic_top/stats.h b/src/traffic_top/stats.h
index ffec58c..2bc030c 100644
--- a/src/traffic_top/stats.h
+++ b/src/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)
{
@@ -524,6 +525,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;