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 /filter | |
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 'filter')
-rw-r--r-- | filter/source/msfilter/escherex.cxx | 3 | ||||
-rw-r--r-- | filter/source/msfilter/msdffimp.cxx | 6 | ||||
-rw-r--r-- | filter/source/svg/svgwriter.cxx | 6 | ||||
-rw-r--r-- | filter/source/t602/t602filter.cxx | 3 |
4 files changed, 6 insertions, 12 deletions
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index b3dbfde83ba5..0079569f9ec5 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -4479,8 +4479,7 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, const OStrin nBlibId = ImplInsertBlib( p_EscherBlibEntry ), p_EscherBlibEntry = NULL; } } - if ( p_EscherBlibEntry ) - delete p_EscherBlibEntry; + delete p_EscherBlibEntry; return nBlibId; } diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index 6053ae3a76db..3cf0c9ebcecd 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -4987,15 +4987,13 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt, { case 0x038F: pImpRec->nXAlign = nUDData; break; case 0x0390: - if (pImpRec->pXRelTo) - delete pImpRec->pXRelTo; + delete pImpRec->pXRelTo; pImpRec->pXRelTo = new sal_uInt32; *(pImpRec->pXRelTo) = nUDData; break; case 0x0391: pImpRec->nYAlign = nUDData; break; case 0x0392: - if (pImpRec->pYRelTo) - delete pImpRec->pYRelTo; + delete pImpRec->pYRelTo; pImpRec->pYRelTo = new sal_uInt32; *(pImpRec->pYRelTo) = nUDData; break; diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx index 0226922d31ee..d637ccbaed3c 100644 --- a/filter/source/svg/svgwriter.cxx +++ b/filter/source/svg/svgwriter.cxx @@ -106,10 +106,8 @@ SVGAttributeWriter::SVGAttributeWriter( SVGExport& rExport, SVGFontExport& rFont SVGAttributeWriter::~SVGAttributeWriter() { - if( mpElemPaint ) - delete mpElemPaint; - if( mpElemFont ) - delete mpElemFont; + delete mpElemPaint; + delete mpElemFont; } double SVGAttributeWriter::ImplRound( double fValue, sal_Int32 nDecs ) diff --git a/filter/source/t602/t602filter.cxx b/filter/source/t602/t602filter.cxx index 0623c2e64406..a590b2300e2b 100644 --- a/filter/source/t602/t602filter.cxx +++ b/filter/source/t602/t602filter.cxx @@ -883,8 +883,7 @@ T602ImportFilterDialog::T602ImportFilterDialog(const ::com::sun::star::uno::Refe T602ImportFilterDialog::~T602ImportFilterDialog() { - if (mpResMgr) - delete mpResMgr; + delete mpResMgr; } // XLocalizable |