diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2015-06-13 22:15:31 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-06-15 14:46:41 +0200 |
commit | 4729774b244db7a175077ed0c70aa48be62bc60e (patch) | |
tree | 9f0f2e329d269835d4c20a8183a2772b734608f3 /shell/source | |
parent | 9db80b1499e09cde000160434728f7b231c30db8 (diff) |
remove unnecessary check for null when calling delete
Idea originally from caolan.
Found using the following command:
find . -name *.cxx | xargs /opt/local/bin/grep -zlP '(?m)if\s*\(\s*\w+\s*\)\s*delete\s+\w+\;'
Change-Id: I3338f4e22193a6dfd6219c8c75835224a3392763
Diffstat (limited to 'shell/source')
-rw-r--r-- | shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx b/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx index fbc38528430c..dbb4402dd0c0 100644 --- a/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx +++ b/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx @@ -108,13 +108,9 @@ COooFilter::COooFilter() : COooFilter::~COooFilter() { delete [] m_pAttributes; - - if (m_pContentReader) - delete m_pContentReader; - if (m_pMetaInfoReader) - delete m_pMetaInfoReader; - if (m_pStream) - delete m_pStream; + delete m_pContentReader; + delete m_pMetaInfoReader; + delete m_pStream; InterlockedDecrement( &g_lInstances ); } @@ -576,12 +572,10 @@ SCODE STDMETHODCALLTYPE COooFilter::Load(LPCWSTR pszFileName, DWORD /*dwMode*/) // Open the file previously specified in call to IPersistFile::Load and get content. try { - if (m_pMetaInfoReader) - delete m_pMetaInfoReader; + delete m_pMetaInfoReader; m_pMetaInfoReader = new CMetaInfoReader(WStringToString(m_pwszFileName)); - if (m_pContentReader) - delete m_pContentReader; + delete m_pContentReader; m_pContentReader = new CContentReader(WStringToString(m_pwszFileName), m_pMetaInfoReader->getDefaultLocale()); } catch (const std::exception&) @@ -637,12 +631,10 @@ SCODE STDMETHODCALLTYPE COooFilter::Load(IStream *pStm) m_pStream = new BufferStream(pStm); try { - if (m_pMetaInfoReader) - delete m_pMetaInfoReader; + delete m_pMetaInfoReader; m_pMetaInfoReader = new CMetaInfoReader(m_pStream); - if (m_pContentReader) - delete m_pContentReader; + delete m_pContentReader; m_pContentReader = new CContentReader(m_pStream, m_pMetaInfoReader->getDefaultLocale()); } catch (const std::exception&) |