From d724a4776c52bae4409b9c6b7e2936640e97d559 Mon Sep 17 00:00:00 2001 From: sebastinas Date: Tue, 26 May 2009 20:09:30 +0000 Subject: [PATCH] Some cleanup in CSmartPtr Removed CSmartPtr's GetCount and renamed GetClientCount to GetCount. The version returning a pointer is not used anyway. Furthermore removed a check for a null pointer which is already checked some lines above and replaced m_pType = &(*CopyFrom) with m_tType = CopyFrom.m_pType, since an overloaded operator & could break this code (it doesn't matter if we check the m_pType afterwards. It could be nonezero and invalid anyway). git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1522 726aef4b-f618-498e-8847-2d620e286838 --- Utils.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Utils.h b/Utils.h index 3c11a115..ec2190de 100644 --- a/Utils.h +++ b/Utils.h @@ -396,13 +396,11 @@ public: return *this; // Then just bail out } - m_pType = &(*CopyFrom); // Make our pointers reference the same raw pointer and counter + m_pType = CopyFrom.m_pType; // Make our pointers reference the same raw pointer and counter m_puCount = CopyFrom.m_puCount; - if (m_pType) { // If we now point to something valid, increment the counter - assert(m_puCount); - (*m_puCount)++; - } + assert(m_puCount); // We now point to something valid, so increment the counter + (*m_puCount)++; } return *this; @@ -463,8 +461,7 @@ public: // Getters T* GetPtr() const { return m_pType; } - const unsigned int* GetCount() const { return m_puCount; } - unsigned int GetClientCount() const { return (m_puCount) ? *m_puCount : 0; } + unsigned int GetCount() const { return (m_puCount) ? *m_puCount : 0; } // !Getters private: T* m_pType; //!< Raw pointer to the class being referenced