trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpe...@apache.org
Subject git commit: TS-1879: make Ptr conversion constructor explicit
Date Mon, 06 May 2013 17:35:55 GMT
Updated Branches:
  refs/heads/master abb0d748d -> 05b9579ac


TS-1879: make Ptr conversion constructor explicit


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/05b9579a
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/05b9579a
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/05b9579a

Branch: refs/heads/master
Commit: 05b9579ac1b983fd3e12b8406870671684c89c92
Parents: abb0d74
Author: James Peach <jpeach@apache.org>
Authored: Wed May 1 14:13:32 2013 -0700
Committer: James Peach <jpeach@apache.org>
Committed: Mon May 6 10:26:40 2013 -0700

----------------------------------------------------------------------
 CHANGES                         |    2 ++
 iocore/cache/Cache.cc           |    2 +-
 iocore/cluster/ClusterCache.cc  |    2 +-
 iocore/dns/DNS.cc               |    2 +-
 iocore/dns/SplitDNS.cc          |    2 +-
 lib/ts/Ptr.h                    |   17 ++++++++++++++---
 proxy/CacheControl.cc           |    2 +-
 proxy/ParentSelection.cc        |    2 +-
 proxy/Prefetch.cc               |    2 +-
 proxy/ReverseProxy.cc           |    2 +-
 proxy/congest/CongestionTest.cc |    4 ++--
 proxy/logging/Log.cc            |   10 +++++-----
 12 files changed, 31 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/05b9579a/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 2df36aa..265eb4f 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,8 @@
   Changes with Apache Traffic Server 3.3.3
 
 
+  *) [TS-1879] Make the Ptr<> conversion constructor explicit.
+
   *) [TS-1768] Prefer AC_SEARCH_LIBS to AC_CHECK_LIB to avoid unnecessary linking.
 
   *) [TS-1877] Fix multiple Lua remap plugin instance creation.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/05b9579a/iocore/cache/Cache.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc
index 580d49b..fbb97f3 100644
--- a/iocore/cache/Cache.cc
+++ b/iocore/cache/Cache.cc
@@ -2245,7 +2245,7 @@ Cache::remove(Continuation *cont, CacheKey *key, CacheFragType type,
 
   ink_assert(this);
 
-  Ptr<ProxyMutex> mutex = NULL;
+  Ptr<ProxyMutex> mutex;
   if (!cont)
     cont = new_CacheRemoveCont();
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/05b9579a/iocore/cluster/ClusterCache.cc
----------------------------------------------------------------------
diff --git a/iocore/cluster/ClusterCache.cc b/iocore/cluster/ClusterCache.cc
index 06a23d2..09865ac 100644
--- a/iocore/cluster/ClusterCache.cc
+++ b/iocore/cluster/ClusterCache.cc
@@ -1977,7 +1977,7 @@ cache_op_result_ClusterFunction(ClusterHandler *ch, void *d, int l)
   ////////////////////////////////////////////////////////
 
   // Copy reply message data
-  Ptr<IOBufferData> iob = new_IOBufferData(iobuffer_size_to_index(l));
+  Ptr<IOBufferData> iob = make_ptr(new_IOBufferData(iobuffer_size_to_index(l)));
   memcpy(iob->data(), (char *) d, l);
   char *data = iob->data();
   int flen, len = l;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/05b9579a/iocore/dns/DNS.cc
----------------------------------------------------------------------
diff --git a/iocore/dns/DNS.cc b/iocore/dns/DNS.cc
index 3593cd4..ceee91d 100644
--- a/iocore/dns/DNS.cc
+++ b/iocore/dns/DNS.cc
@@ -789,7 +789,7 @@ DNSHandler::recv_dns(int event, Event *e)
           }
         }
       }
-      Ptr<HostEnt> protect_hostent = buf;
+      Ptr<HostEnt> protect_hostent = make_ptr(buf);
       if (dns_process(this, buf, res)) {
         if (dnsc->num == name_server)
           received_one(name_server);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/05b9579a/iocore/dns/SplitDNS.cc
----------------------------------------------------------------------
diff --git a/iocore/dns/SplitDNS.cc b/iocore/dns/SplitDNS.cc
index ea281bf..3fb7081 100644
--- a/iocore/dns/SplitDNS.cc
+++ b/iocore/dns/SplitDNS.cc
@@ -79,7 +79,7 @@ static const char *SDNSResultStr[] = {
 int SplitDNSConfig::m_id = 0;
 int SplitDNSConfig::gsplit_dns_enabled = 0;
 int splitDNSFile_CB(const char *name, RecDataT data_type, RecData data, void *cookie);
-Ptr<ProxyMutex> SplitDNSConfig::dnsHandler_mutex = 0;
+Ptr<ProxyMutex> SplitDNSConfig::dnsHandler_mutex;
 
 
 /* --------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/05b9579a/lib/ts/Ptr.h
----------------------------------------------------------------------
diff --git a/lib/ts/Ptr.h b/lib/ts/Ptr.h
index ddce333..c14759a 100644
--- a/lib/ts/Ptr.h
+++ b/lib/ts/Ptr.h
@@ -106,14 +106,15 @@ NonAtomicRefCountObj::refcount() const
 ////////////////////////////////////////////////////////////////////////
 template<class T> class NonAtomicPtr {
 public:
-  NonAtomicPtr(T * ptr = 0);
+  explicit NonAtomicPtr(T * ptr = 0);
   NonAtomicPtr(const NonAtomicPtr<T> &);
   ~NonAtomicPtr();
 
-  void clear();
   NonAtomicPtr<T> &operator =(const NonAtomicPtr<T> &);
   NonAtomicPtr<T> &operator =(T *);
 
+  void clear();
+
   operator  T *() const
   {
     return (m_ptr);
@@ -152,6 +153,11 @@ public:
   T *m_ptr;
 };
 
+template <typename T>
+NonAtomicPtr<T> make_nonatomic_ptr(T * p) {
+  return NonAtomicPtr<T>(p);
+}
+
 ////////////////////////////////////////////////////////////////////////
 //
 // inline functions definitions
@@ -296,7 +302,7 @@ RefCountObj::refcount() const
 ////////////////////////////////////////////////////////////////////////
 template<class T> class Ptr {
 public:
-  Ptr(T * p = 0);
+  explicit Ptr(T * p = 0);
   Ptr(const Ptr<T> &);
   ~Ptr();
 
@@ -351,6 +357,11 @@ public:
   T *m_ptr;
 };
 
+template <typename T>
+Ptr<T> make_ptr(T * p) {
+  return Ptr<T>(p);
+}
+
 ////////////////////////////////////////////////////////////////////////
 //
 // inline functions definitions

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/05b9579a/proxy/CacheControl.cc
----------------------------------------------------------------------
diff --git a/proxy/CacheControl.cc b/proxy/CacheControl.cc
index 37a3a4e..7cc8b5c 100644
--- a/proxy/CacheControl.cc
+++ b/proxy/CacheControl.cc
@@ -71,7 +71,7 @@ static const char *CC_directive_str[CC_NUM_TYPES] = {
 typedef ControlMatcher<CacheControlRecord, CacheControlResult> CC_table;
 
 // Global Ptrs
-static Ptr<ProxyMutex> reconfig_mutex = NULL;
+static Ptr<ProxyMutex> reconfig_mutex;
 CC_table *CacheControlTable = NULL;
 
 void

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/05b9579a/proxy/ParentSelection.cc
----------------------------------------------------------------------
diff --git a/proxy/ParentSelection.cc b/proxy/ParentSelection.cc
index 8b2df5d..8f95692 100644
--- a/proxy/ParentSelection.cc
+++ b/proxy/ParentSelection.cc
@@ -877,7 +877,7 @@ createDefaultParent(char *val)
 //
 
 int SocksServerConfig::m_id = 0;
-static Ptr<ProxyMutex> socks_server_reconfig_mutex = NULL;
+static Ptr<ProxyMutex> socks_server_reconfig_mutex;
 void
 SocksServerConfig::startup()
 {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/05b9579a/proxy/Prefetch.cc
----------------------------------------------------------------------
diff --git a/proxy/Prefetch.cc b/proxy/Prefetch.cc
index c8ee72c..eacb333 100644
--- a/proxy/Prefetch.cc
+++ b/proxy/Prefetch.cc
@@ -315,7 +315,7 @@ public:
   int conf_update_handler(int event, void *edata);
 };
 
-static Ptr<ProxyMutex> prefetch_reconfig_mutex = NULL;
+static Ptr<ProxyMutex> prefetch_reconfig_mutex;
 
 /** Used to free old PrefetchConfiguration data. */
 struct PrefetchConfigFreerCont;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/05b9579a/proxy/ReverseProxy.cc
----------------------------------------------------------------------
diff --git a/proxy/ReverseProxy.cc b/proxy/ReverseProxy.cc
index 740b1ea..95c12c4 100644
--- a/proxy/ReverseProxy.cc
+++ b/proxy/ReverseProxy.cc
@@ -48,7 +48,7 @@
 #define URL_REWRITE_TIMEOUT            (HRTIME_SECOND*60)
 
 // Global Ptrs
-static Ptr<ProxyMutex> reconfig_mutex = NULL;
+static Ptr<ProxyMutex> reconfig_mutex;
 UrlRewrite *rewrite_table = NULL;
 remap_plugin_info *remap_pi_list; // We never reload the remap plugins, just append to 'em.
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/05b9579a/proxy/congest/CongestionTest.cc
----------------------------------------------------------------------
diff --git a/proxy/congest/CongestionTest.cc b/proxy/congest/CongestionTest.cc
index 9372f65..372bf33 100644
--- a/proxy/congest/CongestionTest.cc
+++ b/proxy/congest/CongestionTest.cc
@@ -358,7 +358,7 @@ Ldone:
 
 EXCLUSIVE_REGRESSION_TEST(Congestion_FailHistory) (RegressionTest * t, int atype, int *pstatus)
{
   NOWARN_UNUSED(atype);
-  CCFailHistoryTestCont *test = new CCFailHistoryTestCont(new_ProxyMutex(), t);
+  CCFailHistoryTestCont *test = new CCFailHistoryTestCont(make_ptr(new_ProxyMutex()), t);
   eventProcessor.schedule_in(test, HRTIME_SECONDS(1));
   *pstatus = REGRESSION_TEST_INPROGRESS;
 }
@@ -538,7 +538,7 @@ CCCongestionDBTestCont::mainEvent(int event, Event * e)
 
 EXCLUSIVE_REGRESSION_TEST(Congestion_CongestionDB) (RegressionTest * t, int atype, int *pstatus)
{
   NOWARN_UNUSED(atype);
-  CCCongestionDBTestCont *test = new CCCongestionDBTestCont(new_ProxyMutex(), t);
+  CCCongestionDBTestCont *test = new CCCongestionDBTestCont(make_ptr(new_ProxyMutex()), t);
   eventProcessor.schedule_in(test, HRTIME_SECONDS(1));
   *pstatus = REGRESSION_TEST_INPROGRESS;
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/05b9579a/proxy/logging/Log.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/Log.cc b/proxy/logging/Log.cc
index 7bc6eed..b81d727 100644
--- a/proxy/logging/Log.cc
+++ b/proxy/logging/Log.cc
@@ -493,7 +493,7 @@ Log::init_fields()
   global_field_list.add(field, false);
   ink_hash_table_insert(field_symbol_hash, "cqbl", field);
 
-  Ptr<LogFieldAliasTable> finish_status_map = NEW(new LogFieldAliasTable);
+  Ptr<LogFieldAliasTable> finish_status_map = make_ptr(NEW(new LogFieldAliasTable));
   finish_status_map->init(N_LOG_FINISH_CODE_TYPES,
                           LOG_FINISH_FIN, "FIN",
                           LOG_FINISH_INTR, "INTR",
@@ -563,7 +563,7 @@ Log::init_fields()
   global_field_list.add(field, false);
   ink_hash_table_insert(field_symbol_hash, "pfsc", field);
 
-  Ptr<LogFieldAliasTable> cache_code_map = NEW(new LogFieldAliasTable);
+  Ptr<LogFieldAliasTable> cache_code_map = make_ptr(NEW(new LogFieldAliasTable));
   cache_code_map->init(49,
                        SQUID_LOG_EMPTY, "UNDEFINED",
                        SQUID_LOG_TCP_HIT, "TCP_HIT",
@@ -665,7 +665,7 @@ Log::init_fields()
   global_field_list.add(field, false);
   ink_hash_table_insert(field_symbol_hash, "pqsi", field);
 
-  Ptr<LogFieldAliasTable> hierarchy_map = NEW(new LogFieldAliasTable);
+  Ptr<LogFieldAliasTable> hierarchy_map = make_ptr(NEW(new LogFieldAliasTable));
   hierarchy_map->init(36,
                       SQUID_HIER_EMPTY, "EMPTY",
                       SQUID_HIER_NONE, "NONE",
@@ -805,7 +805,7 @@ Log::init_fields()
 
   // cache write fields
 
-  Ptr<LogFieldAliasTable> cache_write_code_map = NEW(new LogFieldAliasTable);
+  Ptr<LogFieldAliasTable> cache_write_code_map = make_ptr(NEW(new LogFieldAliasTable));
   cache_write_code_map->init(N_LOG_CACHE_WRITE_TYPES,
                              LOG_CACHE_WRITE_NONE, "-",
                              LOG_CACHE_WRITE_LOCK_MISSED, "WL_MISS",
@@ -852,7 +852,7 @@ Log::init_fields()
   global_field_list.add(field, false);
   ink_hash_table_insert(field_symbol_hash, "fsiz", field);
 
-  Ptr<LogFieldAliasTable> entry_type_map = NEW(new LogFieldAliasTable);
+  Ptr<LogFieldAliasTable> entry_type_map = make_ptr(NEW(new LogFieldAliasTable));
   entry_type_map->init(N_LOG_ENTRY_TYPES,
                        LOG_ENTRY_HTTP, "LOG_ENTRY_HTTP",
                        LOG_ENTRY_ICP, "LOG_ENTRY_ICP");


Mime
View raw message