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 /framework | |
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 'framework')
-rw-r--r-- | framework/source/uielement/addonstoolbarmanager.cxx | 3 | ||||
-rw-r--r-- | framework/source/uielement/fontsizemenucontroller.cxx | 3 | ||||
-rw-r--r-- | framework/source/uielement/statusbarmanager.cxx | 3 |
3 files changed, 3 insertions, 6 deletions
diff --git a/framework/source/uielement/addonstoolbarmanager.cxx b/framework/source/uielement/addonstoolbarmanager.cxx index 1e5fbf9f4d89..22393d27b537 100644 --- a/framework/source/uielement/addonstoolbarmanager.cxx +++ b/framework/source/uielement/addonstoolbarmanager.cxx @@ -148,8 +148,7 @@ void SAL_CALL AddonsToolBarManager::dispose() throw( RuntimeException, std::exce if ( nId > 0 ) { AddonsParams* pRuntimeItemData = static_cast<AddonsParams*>(m_pToolBar->GetItemData( nId )); - if ( pRuntimeItemData ) - delete pRuntimeItemData; + delete pRuntimeItemData; m_pToolBar->SetItemData( nId, NULL ); } } diff --git a/framework/source/uielement/fontsizemenucontroller.cxx b/framework/source/uielement/fontsizemenucontroller.cxx index a0229d6b8a11..97b2d1baab7e 100644 --- a/framework/source/uielement/fontsizemenucontroller.cxx +++ b/framework/source/uielement/fontsizemenucontroller.cxx @@ -155,8 +155,7 @@ void FontSizeMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& r vcl::FontInfo aFntInfo = pFontList->Get( m_aFontDescriptor.Name, m_aFontDescriptor.StyleName ); // setup font size array - if ( m_pHeightArray ) - delete m_pHeightArray; + delete m_pHeightArray; const sal_IntPtr* pTempAry; const sal_IntPtr* pAry = pFontList->GetSizeAry( aFntInfo ); diff --git a/framework/source/uielement/statusbarmanager.cxx b/framework/source/uielement/statusbarmanager.cxx index 80e81c03032b..a9a33a41c053 100644 --- a/framework/source/uielement/statusbarmanager.cxx +++ b/framework/source/uielement/statusbarmanager.cxx @@ -210,8 +210,7 @@ void SAL_CALL StatusBarManager::dispose() throw( uno::RuntimeException, std::exc { AddonStatusbarItemData *pUserData = static_cast< AddonStatusbarItemData *>( m_pStatusBar->GetItemData( m_pStatusBar->GetItemId( n ) ) ); - if ( pUserData ) - delete pUserData; + delete pUserData; } m_pStatusBar.disposeAndClear(); |