You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jp...@apache.org on 2016/05/07 16:07:39 UTC

[trafficserver] branch master updated (c32379b -> cac8bed)

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

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

      from  c32379b   TS-4418: Update code with new .clang-format config change
       new  72abdb9   Remove unused NonAtomicPtr.
       new  cac8bed   Make clang-format work on out of tree builds.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.


Summary of changes:
 lib/ts/Ptr.h          | 197 +-------------------------------------------------
 tools/clang-format.sh |   2 +-
 2 files changed, 4 insertions(+), 195 deletions(-)

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

[trafficserver] 01/02: Remove unused NonAtomicPtr.

Posted by jp...@apache.org.
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 72abdb9a1d77cabae63a6105267da655af5d1367
Author: James Peach <jp...@apache.org>
AuthorDate: Wed May 4 21:24:13 2016 -0700

    Remove unused NonAtomicPtr.
---
 lib/ts/Ptr.h | 197 +----------------------------------------------------------
 1 file changed, 3 insertions(+), 194 deletions(-)

diff --git a/lib/ts/Ptr.h b/lib/ts/Ptr.h
index c43330a..a8d130a 100644
--- a/lib/ts/Ptr.h
+++ b/lib/ts/Ptr.h
@@ -21,202 +21,11 @@
   limitations under the License.
  */
 
-/*************************** -*- Mod: C++ -*- ******************************
-
-   Atmic and non-atomic smart pointers.
-
-   Note: it would have been nice to have one 'Ptr' class, but the
-   templating system on some compilers is so broken that it cannot
-   correctly compile Ptr without downcasting the m_ptr object to
-   a RefCountObj.
-
-
- ****************************************************************************/
-#if !defined(_Ptr_h_)
-#define _Ptr_h_
+#ifndef PTR_H_FBBD7DC3_CA5D_4715_9162_5E4DDA93353F
+#define PTR_H_FBBD7DC3_CA5D_4715_9162_5E4DDA93353F
 
 #include "ts/ink_atomic.h"
 
-////////////////////////////////////////////////////////////////////////
-//
-// class NonAtomicRefCountObj
-// prototypical class for reference counting
-//
-////////////////////////////////////////////////////////////////////////
-class NonAtomicRefCountObj
-{
-public:
-  NonAtomicRefCountObj() : m_refcount(0) { return; }
-  NonAtomicRefCountObj(const NonAtomicRefCountObj &s) : m_refcount(0)
-  {
-    (void)s;
-    return;
-  }
-  virtual ~NonAtomicRefCountObj() { return; }
-  NonAtomicRefCountObj &
-  operator=(const NonAtomicRefCountObj &s)
-  {
-    (void)s;
-    return (*this);
-  }
-
-  int refcount_inc();
-  int refcount_dec();
-  int refcount() const;
-
-  virtual void
-  free()
-  {
-    delete this;
-  }
-
-  volatile int m_refcount;
-};
-
-inline int
-NonAtomicRefCountObj::refcount_inc()
-{
-  return ++m_refcount;
-}
-
-#define NONATOMIC_REF_COUNT_OBJ_REFCOUNT_INC(_x) (_x)->refcount_inc()
-
-inline int
-NonAtomicRefCountObj::refcount_dec()
-{
-  return --m_refcount;
-}
-
-#define NONATOMIC_REF_COUNT_OBJ_REFCOUNT_DEC(_x) (_x)->refcount_dec()
-
-inline int
-NonAtomicRefCountObj::refcount() const
-{
-  return m_refcount;
-}
-
-////////////////////////////////////////////////////////////////////////
-//
-// class NonAtomicPtr
-//
-////////////////////////////////////////////////////////////////////////
-template <class T> class NonAtomicPtr
-{
-public:
-  explicit NonAtomicPtr(T *ptr = 0);
-  NonAtomicPtr(const NonAtomicPtr<T> &);
-  ~NonAtomicPtr();
-
-  NonAtomicPtr<T> &operator=(const NonAtomicPtr<T> &);
-  NonAtomicPtr<T> &operator=(T *);
-
-  void clear();
-
-  operator T *() const { return (m_ptr); }
-  T *operator->() const { return (m_ptr); }
-  T &operator*() const { return (*m_ptr); }
-  int
-  operator==(const T *p)
-  {
-    return (m_ptr == p);
-  }
-  int
-  operator==(const NonAtomicPtr<T> &p)
-  {
-    return (m_ptr == p.m_ptr);
-  }
-  int
-  operator!=(const T *p)
-  {
-    return (m_ptr != p);
-  }
-  int
-  operator!=(const NonAtomicPtr<T> &p)
-  {
-    return (m_ptr != p.m_ptr);
-  }
-
-  NonAtomicRefCountObj *
-  _ptr()
-  {
-    return (NonAtomicRefCountObj *)m_ptr;
-  }
-
-  T *m_ptr;
-};
-
-template <typename T>
-NonAtomicPtr<T>
-make_nonatomic_ptr(T *p)
-{
-  return NonAtomicPtr<T>(p);
-}
-
-////////////////////////////////////////////////////////////////////////
-//
-// inline functions definitions
-//
-////////////////////////////////////////////////////////////////////////
-template <class T> inline NonAtomicPtr<T>::NonAtomicPtr(T *ptr /* = 0 */) : m_ptr(ptr)
-{
-  if (m_ptr)
-    _ptr()->refcount_inc();
-  return;
-}
-
-template <class T> inline NonAtomicPtr<T>::NonAtomicPtr(const NonAtomicPtr<T> &src) : m_ptr(src.m_ptr)
-{
-  if (m_ptr)
-    _ptr()->refcount_inc();
-  return;
-}
-
-template <class T> inline NonAtomicPtr<T>::~NonAtomicPtr()
-{
-  if ((m_ptr) && _ptr()->refcount_dec() == 0) {
-    _ptr()->free();
-  }
-  return;
-}
-
-template <class T>
-inline NonAtomicPtr<T> &
-NonAtomicPtr<T>::operator=(T *p)
-{
-  T *temp_ptr = m_ptr;
-
-  if (m_ptr == p)
-    return (*this);
-
-  m_ptr = p;
-
-  if (m_ptr != 0) {
-    _ptr()->refcount_inc();
-  }
-
-  if ((temp_ptr) && ((NonAtomicRefCountObj *)temp_ptr)->refcount_dec() == 0) {
-    ((NonAtomicRefCountObj *)temp_ptr)->free();
-  }
-
-  return (*this);
-}
-template <class T>
-inline void
-NonAtomicPtr<T>::clear()
-{
-  if (m_ptr) {
-    if (!((NonAtomicRefCountObj *)m_ptr)->refcount_dec())
-      ((NonAtomicRefCountObj *)m_ptr)->free();
-    m_ptr = NULL;
-  }
-}
-template <class T>
-inline NonAtomicPtr<T> &
-NonAtomicPtr<T>::operator=(const NonAtomicPtr<T> &src)
-{
-  return (operator=(src.m_ptr));
-}
-
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //////              ATOMIC VERSIONS
@@ -419,4 +228,4 @@ Ptr<T>::operator=(const Ptr<T> &src)
   return (operator=(src.m_ptr));
 }
 
-#endif
+#endif /* PTR_H_FBBD7DC3_CA5D_4715_9162_5E4DDA93353F */

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

[trafficserver] 02/02: Make clang-format work on out of tree builds.

Posted by jp...@apache.org.
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 cac8bed563cbfdc835efebb8ade1b6e157edbb3a
Author: James Peach <jp...@apache.org>
AuthorDate: Sat May 7 09:02:59 2016 -0700

    Make clang-format work on out of tree builds.
---
 tools/clang-format.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/clang-format.sh b/tools/clang-format.sh
index f9b9544..9a5475b 100755
--- a/tools/clang-format.sh
+++ b/tools/clang-format.sh
@@ -21,7 +21,7 @@
 set -e # exit on error
 
 DIR=${1:-.}
-ROOT=${ROOT:-$(git rev-parse --show-toplevel)/.git/fmt}
+ROOT=${ROOT:-$(cd $(dirname $0) && git rev-parse --show-toplevel)/.git/fmt}
 PACKAGE="clang-format-20160415.tar.bz2"
 VERSION="clang-format version 3.9.0 (trunk 265913)"
 

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