mirror of
https://github.com/znc/znc.git
synced 2026-08-07 01:13:25 +02:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user