Skip to content
This repository has been archived by the owner on Sep 24, 2024. It is now read-only.

Remove unnecessary Null pointer check #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions core/include/SmartMemory.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,7 @@ public:
// Destructor. Deletes the object.
~TSmartMemory() throw()
{
if (m_pT)
{
delete m_pT;
}
delete m_pT;
}

// Casting to T*
Expand All @@ -72,10 +69,7 @@ public:
// Assignment from non-smart pointer
T* operator=(T* pT) throw()
{
if (m_pT)
{
delete m_pT;
}
delete m_pT;
return m_pT = pT;
}

Expand Down Expand Up @@ -145,10 +139,7 @@ public:
}
else
{
if (m_pT)
{
delete m_pT;
}
delete m_pT;

// Transfer ownership
m_pT = spT.Extract();
Expand Down