trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpe...@apache.org
Subject [trafficserver] 02/33: TS-4425: Bring RefCountObj methods inline for readability.
Date Wed, 11 May 2016 20:31:26 GMT
This is an automated email from the ASF dual-hosted git repository.

jpeach pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

commit c1b2b98e7a3dea930a19f47a5d357f64eda047aa
Author: James Peach <jpeach@apache.org>
AuthorDate: Wed May 4 21:49:09 2016 -0700

    TS-4425: Bring RefCountObj methods inline for readability.
---
 lib/ts/Ptr.h | 44 ++++++++++++++++++++------------------------
 1 file changed, 20 insertions(+), 24 deletions(-)

diff --git a/lib/ts/Ptr.h b/lib/ts/Ptr.h
index edefcf2..b7b86be 100644
--- a/lib/ts/Ptr.h
+++ b/lib/ts/Ptr.h
@@ -51,6 +51,7 @@ public:
     (void)s;
     return;
   }
+
   virtual ~RefCountObj() {}
   RefCountObj &
   operator=(const RefCountObj &s)
@@ -59,9 +60,25 @@ public:
     return (*this);
   }
 
-  int refcount_inc();
-  int refcount_dec();
-  int refcount() const;
+  // Increment the reference count, returning the new count.
+  int
+  refcount_inc()
+  {
+    return ink_atomic_increment((int *)&m_refcount, 1) + 1;
+  }
+
+  // Decrement the reference count, returning the new count.
+  int
+  refcount_dec()
+  {
+    return ink_atomic_increment((int *)&m_refcount, -1) - 1;
+  }
+
+  int
+  refcount() const
+  {
+    return m_refcount;
+  }
 
   virtual void
   free()
@@ -73,30 +90,9 @@ private:
   volatile int m_refcount;
 };
 
-// Increment the reference count, returning the new count.
-inline int
-RefCountObj::refcount_inc()
-{
-  return ink_atomic_increment((int *)&m_refcount, 1) + 1;
-}
-
 #define REF_COUNT_OBJ_REFCOUNT_INC(_x) (_x)->refcount_inc()
-
-// Decrement the reference count, returning the new count.
-inline int
-RefCountObj::refcount_dec()
-{
-  return ink_atomic_increment((int *)&m_refcount, -1) - 1;
-}
-
 #define REF_COUNT_OBJ_REFCOUNT_DEC(_x) (_x)->refcount_dec()
 
-inline int
-RefCountObj::refcount() const
-{
-  return m_refcount;
-}
-
 ////////////////////////////////////////////////////////////////////////
 //
 // class Ptr

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

Mime
View raw message