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
This commit is contained in:
sebastinas
2009-05-26 20:09:30 +00:00
parent f36ad9e6e7
commit d724a4776c
+4 -7
View File
@@ -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