diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2015-06-13 22:15:31 +0200 |
---|---|---|
committer | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2016-02-06 09:12:18 -0500 |
commit | 8ebcaeb22f6fe05750b50631dc67299b2f78e4e3 (patch) | |
tree | 4746f4715e61b195d5b0b8758a0a4bca5058dfa3 /sd | |
parent | a9609b568ce74fa426d3322dd9270eba9c4d038a (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
(cherry picked from commit 4729774b244db7a175077ed0c70aa48be62bc60e)
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/core/sdpage.cxx | 3 | ||||
-rw-r--r-- | sd/source/filter/html/pubdlg.cxx | 3 | ||||
-rw-r--r-- | sd/source/ui/animations/CustomAnimationDialog.cxx | 6 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unopback.cxx | 3 | ||||
-rw-r--r-- | sd/source/ui/view/outlview.cxx | 11 |
5 files changed, 8 insertions, 18 deletions
diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx index 5a8de34029fe..80cd7520bbfc 100644 --- a/sd/source/core/sdpage.cxx +++ b/sd/source/core/sdpage.cxx @@ -145,8 +145,7 @@ SdPage::~SdPage() EndListenOutlineText(); - if( mpItems ) - delete mpItems; + delete mpItems; Clear(); } diff --git a/sd/source/filter/html/pubdlg.cxx b/sd/source/filter/html/pubdlg.cxx index 033eeb0fe52b..9bdf9cf915f0 100644 --- a/sd/source/filter/html/pubdlg.cxx +++ b/sd/source/filter/html/pubdlg.cxx @@ -1549,8 +1549,7 @@ bool SdPublishingDlg::Load() bool bOk = pIStm && ( pIStm->GetError() == 0); - if( pIStm ) - delete pIStm; + delete pIStm; if( !bOk ) return false; diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx index 633427ec3e80..f0bf4bf81c1e 100644 --- a/sd/source/ui/animations/CustomAnimationDialog.cxx +++ b/sd/source/ui/animations/CustomAnimationDialog.cxx @@ -2217,8 +2217,7 @@ void CustomAnimationDialog::dispose() STLPropertySet* CustomAnimationDialog::getResultSet() { - if( mpResultSet ) - delete mpResultSet; + delete mpResultSet; mpResultSet = createDefaultSet(); @@ -2292,8 +2291,7 @@ PropertyControl::~PropertyControl() void PropertyControl::dispose() { - if( mpSubControl ) - delete mpSubControl; + delete mpSubControl; ListBox::dispose(); } diff --git a/sd/source/ui/unoidl/unopback.cxx b/sd/source/ui/unoidl/unopback.cxx index 53be94336ebf..899388a4c9c6 100644 --- a/sd/source/ui/unoidl/unopback.cxx +++ b/sd/source/ui/unoidl/unopback.cxx @@ -75,8 +75,7 @@ SdUnoPageBackground::~SdUnoPageBackground() throw() if( mpDoc ) EndListening( *mpDoc ); - if( mpSet ) - delete mpSet; + delete mpSet; } void SdUnoPageBackground::Notify( SfxBroadcaster&, const SfxHint& rHint ) diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx index 98d0af9ddb41..7f190aea6a70 100644 --- a/sd/source/ui/view/outlview.cxx +++ b/sd/source/ui/view/outlview.cxx @@ -175,8 +175,7 @@ OutlineView::~OutlineView() mrOutlineViewShell.GetViewShellBase().GetEventMultiplexer()->RemoveEventListener( aLink ); DisconnectFromApplication(); - if( mpProgress ) - delete mpProgress; + delete mpProgress; // unregister OutlinerViews and destroy them for (sal_uInt16 nView = 0; nView < MAX_OUTLINERVIEWS; nView++) @@ -604,9 +603,7 @@ IMPL_LINK( OutlineView, DepthChangedHdl, ::Outliner *, pOutliner ) if (mnPagesToProcess > PROCESS_WITH_PROGRESS_THRESHOLD) { - if( mpProgress ) - delete mpProgress; - + delete mpProgress; mpProgress = new SfxProgress( GetDocSh(), SD_RESSTR(STR_CREATE_PAGES), mnPagesToProcess ); } else @@ -1196,9 +1193,7 @@ IMPL_LINK_NOARG(OutlineView, RemovingPagesHdl) if (mnPagesToProcess) { - if( mpProgress ) - delete mpProgress; - + delete mpProgress; mpProgress = new SfxProgress( GetDocSh(), SD_RESSTR(STR_DELETE_PAGES), mnPagesToProcess ); } mrOutliner.UpdateFields(); |