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 /sd | |
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 '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 455640e1a0e1..7d985036bcec 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(); |