summaryrefslogtreecommitdiff
path: root/lotuswordpro
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2015-06-13 22:15:31 +0200
committerNoel Grandin <noel@peralex.com>2015-06-15 14:46:41 +0200
commit4729774b244db7a175077ed0c70aa48be62bc60e (patch)
tree9f0f2e329d269835d4c20a8183a2772b734608f3 /lotuswordpro
parent9db80b1499e09cde000160434728f7b231c30db8 (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 'lotuswordpro')
-rw-r--r--lotuswordpro/source/filter/lwpbreaksoverride.cxx3
-rw-r--r--lotuswordpro/source/filter/lwpfoundry.cxx18
-rw-r--r--lotuswordpro/source/filter/lwpfrib.cxx3
-rw-r--r--lotuswordpro/source/filter/lwpobj.cxx3
-rw-r--r--lotuswordpro/source/filter/lwpparaborderoverride.cxx12
-rw-r--r--lotuswordpro/source/filter/xfilter/xfcell.cxx3
-rw-r--r--lotuswordpro/source/filter/xfilter/xfcellstyle.cxx9
-rw-r--r--lotuswordpro/source/filter/xfilter/xfconfigmanager.cxx6
-rw-r--r--lotuswordpro/source/filter/xfilter/xfframestyle.cxx24
-rw-r--r--lotuswordpro/source/filter/xfilter/xfheaderstyle.cxx15
-rw-r--r--lotuswordpro/source/filter/xfilter/xfindex.cxx5
-rw-r--r--lotuswordpro/source/filter/xfilter/xfmasterpage.cxx12
-rw-r--r--lotuswordpro/source/filter/xfilter/xfpagemaster.cxx21
-rw-r--r--lotuswordpro/source/filter/xfilter/xfparastyle.cxx14
-rw-r--r--lotuswordpro/source/filter/xfilter/xfrow.cxx13
-rw-r--r--lotuswordpro/source/filter/xfilter/xfrowstyle.cxx3
-rw-r--r--lotuswordpro/source/filter/xfilter/xfsaxstream.cxx3
-rw-r--r--lotuswordpro/source/filter/xfilter/xfsectionstyle.cxx9
-rw-r--r--lotuswordpro/source/filter/xfilter/xfstylemanager.cxx3
-rw-r--r--lotuswordpro/source/filter/xfilter/xftablestyle.cxx6
20 files changed, 57 insertions, 128 deletions
diff --git a/lotuswordpro/source/filter/lwpbreaksoverride.cxx b/lotuswordpro/source/filter/lwpbreaksoverride.cxx
index 12a855ab3748..23f7f83a1f51 100644
--- a/lotuswordpro/source/filter/lwpbreaksoverride.cxx
+++ b/lotuswordpro/source/filter/lwpbreaksoverride.cxx
@@ -79,8 +79,7 @@ LwpBreaksOverride::LwpBreaksOverride(LwpBreaksOverride const& rOther)
LwpBreaksOverride::~LwpBreaksOverride()
{
- if( m_pNextStyle )
- delete m_pNextStyle;
+ delete m_pNextStyle;
}
LwpBreaksOverride* LwpBreaksOverride::clone() const
diff --git a/lotuswordpro/source/filter/lwpfoundry.cxx b/lotuswordpro/source/filter/lwpfoundry.cxx
index d343520ae96e..7e90c366d781 100644
--- a/lotuswordpro/source/filter/lwpfoundry.cxx
+++ b/lotuswordpro/source/filter/lwpfoundry.cxx
@@ -91,20 +91,10 @@ LwpFoundry::LwpFoundry(LwpObjectStream *pStrm, LwpDocument* pDoc)
LwpFoundry::~LwpFoundry()
{
- if(m_pPieceMgr)
- {
- delete m_pPieceMgr;
- }
- if(m_pStyleMgr)
- {
- delete m_pStyleMgr;
- }
- if (m_pDropcapMgr)
- delete m_pDropcapMgr;
- if (m_pBulletStyleMgr)
- {
- delete m_pBulletStyleMgr;
- }
+ delete m_pPieceMgr;
+ delete m_pStyleMgr;
+ delete m_pDropcapMgr;
+ delete m_pBulletStyleMgr;
}
void LwpFoundry::Read(LwpObjectStream *pStrm)
diff --git a/lotuswordpro/source/filter/lwpfrib.cxx b/lotuswordpro/source/filter/lwpfrib.cxx
index f93066082438..851a3db27d53 100644
--- a/lotuswordpro/source/filter/lwpfrib.cxx
+++ b/lotuswordpro/source/filter/lwpfrib.cxx
@@ -102,8 +102,7 @@ LwpFrib::LwpFrib(LwpPara* pPara)
LwpFrib::~LwpFrib()
{
- if(m_pModifiers)
- delete m_pModifiers;
+ delete m_pModifiers;
}
LwpFrib* LwpFrib::CreateFrib(LwpPara* pPara, LwpObjectStream* pObjStrm, sal_uInt8 fribtag,sal_uInt8 editID)
diff --git a/lotuswordpro/source/filter/lwpobj.cxx b/lotuswordpro/source/filter/lwpobj.cxx
index 7e15b6265fe3..5a0a79b3615c 100644
--- a/lotuswordpro/source/filter/lwpobj.cxx
+++ b/lotuswordpro/source/filter/lwpobj.cxx
@@ -74,8 +74,7 @@ LwpObject::LwpObject(LwpObjectHeader objHdr, LwpSvStream* pStrm)
*/
LwpObject::~LwpObject()
{
- if(m_pObjStrm)
- delete m_pObjStrm;
+ delete m_pObjStrm;
}
/**
diff --git a/lotuswordpro/source/filter/lwpparaborderoverride.cxx b/lotuswordpro/source/filter/lwpparaborderoverride.cxx
index 318ff8d40f4c..254dc092c192 100644
--- a/lotuswordpro/source/filter/lwpparaborderoverride.cxx
+++ b/lotuswordpro/source/filter/lwpparaborderoverride.cxx
@@ -113,14 +113,10 @@ LwpParaBorderOverride::LwpParaBorderOverride(LwpParaBorderOverride const& rOther
LwpParaBorderOverride::~LwpParaBorderOverride()
{
- if( m_pBorderStuff )
- delete m_pBorderStuff;
- if( m_pBetweenStuff )
- delete m_pBetweenStuff;
- if( m_pShadow )
- delete m_pShadow;
- if( m_pMargins )
- delete m_pMargins;
+ delete m_pBorderStuff;
+ delete m_pBetweenStuff;
+ delete m_pShadow;
+ delete m_pMargins;
}
LwpParaBorderOverride* LwpParaBorderOverride::clone() const
diff --git a/lotuswordpro/source/filter/xfilter/xfcell.cxx b/lotuswordpro/source/filter/xfilter/xfcell.cxx
index ac79dda1e331..a263a6355ce6 100644
--- a/lotuswordpro/source/filter/xfilter/xfcell.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfcell.cxx
@@ -75,8 +75,7 @@ XFCell::XFCell()
XFCell::~XFCell()
{
- if( m_pSubTable )
- delete m_pSubTable;
+ delete m_pSubTable;
}
void XFCell::Add(XFContent *pContent)
diff --git a/lotuswordpro/source/filter/xfilter/xfcellstyle.cxx b/lotuswordpro/source/filter/xfilter/xfcellstyle.cxx
index b0d4881162b0..a6350e2f1f65 100644
--- a/lotuswordpro/source/filter/xfilter/xfcellstyle.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfcellstyle.cxx
@@ -74,8 +74,7 @@ XFCellStyle::XFCellStyle()
XFCellStyle::~XFCellStyle()
{
- if( m_pBorders )
- delete m_pBorders;
+ delete m_pBorders;
}
void XFCellStyle::SetPadding(double left, double right,double top, double bottom)
@@ -97,15 +96,13 @@ void XFCellStyle::SetBackColor(XFColor& color)
void XFCellStyle::SetBackImage(XFBGImage *pImage)
{
- if( m_pBackImage )
- delete m_pBackImage;
+ delete m_pBackImage;
m_pBackImage = pImage;
}
void XFCellStyle::SetBorders(XFBorders *pBorders)
{
- if( m_pBorders )
- delete m_pBorders;
+ delete m_pBorders;
m_pBorders = pBorders;
}
diff --git a/lotuswordpro/source/filter/xfilter/xfconfigmanager.cxx b/lotuswordpro/source/filter/xfilter/xfconfigmanager.cxx
index 6b218bc42671..dab6c9da91c7 100644
--- a/lotuswordpro/source/filter/xfilter/xfconfigmanager.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfconfigmanager.cxx
@@ -76,15 +76,13 @@ XFConfigManager::~XFConfigManager()
void XFConfigManager::SetLineNumberConfig(XFLineNumberConfig *pLNConfig)
{
- if( m_pLineNumberConfig )
- delete m_pLineNumberConfig;
+ delete m_pLineNumberConfig;
m_pLineNumberConfig = pLNConfig;
}
void XFConfigManager::SetFootnoteConfig(XFFootnoteConfig *pFNConfig)
{
- if( m_pFootnoteConfig )
- delete m_pFootnoteConfig;
+ delete m_pFootnoteConfig;
m_pFootnoteConfig = pFNConfig;
}
diff --git a/lotuswordpro/source/filter/xfilter/xfframestyle.cxx b/lotuswordpro/source/filter/xfilter/xfframestyle.cxx
index a0b485b002f6..b11ce54694e2 100644
--- a/lotuswordpro/source/filter/xfilter/xfframestyle.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfframestyle.cxx
@@ -89,41 +89,33 @@ XFFrameStyle::XFFrameStyle()
XFFrameStyle::~XFFrameStyle()
{
- if( m_pBorders )
- delete m_pBorders;
- if( m_pColumns )
- delete m_pColumns;
- if( m_pShadow )
- delete m_pShadow;
- if( m_pBGImage )
- delete m_pBGImage;
+ delete m_pBorders;
+ delete m_pColumns;
+ delete m_pShadow;
+ delete m_pBGImage;
}
void XFFrameStyle::SetBorders(XFBorders *pBorders)
{
- if( m_pBorders )
- delete m_pBorders;
+ delete m_pBorders;
m_pBorders = pBorders;
}
void XFFrameStyle::SetColumns(XFColumns *pColumns)
{
- if( m_pColumns )
- delete m_pColumns;
+ delete m_pColumns;
m_pColumns = pColumns;
}
void XFFrameStyle::SetShadow(XFShadow *pShadow)
{
- if( m_pShadow )
- delete m_pShadow;
+ delete m_pShadow;
m_pShadow = pShadow;
}
void XFFrameStyle::SetBackImage(XFBGImage *image)
{
- if( m_pBGImage )
- delete m_pBGImage;
+ delete m_pBGImage;
m_pBGImage = image;
}
diff --git a/lotuswordpro/source/filter/xfilter/xfheaderstyle.cxx b/lotuswordpro/source/filter/xfilter/xfheaderstyle.cxx
index 10345c886d83..d2521ab9bf39 100644
--- a/lotuswordpro/source/filter/xfilter/xfheaderstyle.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfheaderstyle.cxx
@@ -73,12 +73,9 @@ XFHeaderStyle::XFHeaderStyle(bool isFooter)
XFHeaderStyle::~XFHeaderStyle()
{
- if( m_pBorders )
- delete m_pBorders;
- if( m_pBGImage )
- delete m_pBGImage;
- if( m_pShadow )
- delete m_pShadow;
+ delete m_pBorders;
+ delete m_pBGImage;
+ delete m_pShadow;
}
void XFHeaderStyle::SetMargins(double left, double right, double bottom)
@@ -114,15 +111,13 @@ void XFHeaderStyle::SetShadow(XFShadow *pShadow)
void XFHeaderStyle::SetBorders(XFBorders *pBorders)
{
- if( m_pBorders )
- delete m_pBorders;
+ delete m_pBorders;
m_pBorders = pBorders;
}
void XFHeaderStyle::SetBackImage(XFBGImage *image)
{
- if( m_pBGImage )
- delete m_pBGImage;
+ delete m_pBGImage;
m_pBGImage = image;
}
diff --git a/lotuswordpro/source/filter/xfilter/xfindex.cxx b/lotuswordpro/source/filter/xfilter/xfindex.cxx
index 40d64feefd9b..a028aa919120 100644
--- a/lotuswordpro/source/filter/xfilter/xfindex.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfindex.cxx
@@ -76,8 +76,7 @@ XFIndex::XFIndex()
XFIndex::~XFIndex()
{
- if( m_pTitle )
- delete m_pTitle;
+ delete m_pTitle;
for(sal_uInt16 i=1;i<MAX_TOC_LEVEL+1;i++)
{
@@ -88,7 +87,7 @@ XFIndex::~XFIndex()
{
XFIndexTemplate * pTemplate = m_aTemplates.back();
m_aTemplates.pop_back();
- delete pTemplate;pTemplate=NULL;
+ delete pTemplate;
}
}
diff --git a/lotuswordpro/source/filter/xfilter/xfmasterpage.cxx b/lotuswordpro/source/filter/xfilter/xfmasterpage.cxx
index 2efc78decb80..084f50e757cf 100644
--- a/lotuswordpro/source/filter/xfilter/xfmasterpage.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfmasterpage.cxx
@@ -71,23 +71,19 @@ XFMasterPage::XFMasterPage()
XFMasterPage::~XFMasterPage()
{
- if( m_pHeader )
- delete m_pHeader;
- if( m_pFooter )
- delete m_pFooter;
+ delete m_pHeader;
+ delete m_pFooter;
}
void XFMasterPage::SetHeader(XFHeader *pHeader)
{
- if( m_pHeader )
- delete m_pHeader;
+ delete m_pHeader;
m_pHeader = pHeader;
}
void XFMasterPage::SetFooter(XFFooter *pFooter)
{
- if( m_pFooter )
- delete m_pFooter;
+ delete m_pFooter;
m_pFooter = pFooter;
}
diff --git a/lotuswordpro/source/filter/xfilter/xfpagemaster.cxx b/lotuswordpro/source/filter/xfilter/xfpagemaster.cxx
index dcf78947de67..15e2fa1e693c 100644
--- a/lotuswordpro/source/filter/xfilter/xfpagemaster.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfpagemaster.cxx
@@ -78,18 +78,12 @@ m_fSepSpaceBelow(0), m_nSepLengthPercent(0)
XFPageMaster::~XFPageMaster()
{
- if( m_pBorders )
- delete m_pBorders;
- if( m_pShadow )
- delete m_pShadow;
- if( m_pColumns )
- delete m_pColumns;
- if( m_pHeaderStyle )
- delete m_pHeaderStyle;
- if( m_pFooterStyle )
- delete m_pFooterStyle;
- if( m_pBGImage )
- delete m_pBGImage;
+ delete m_pBorders;
+ delete m_pShadow;
+ delete m_pColumns;
+ delete m_pHeaderStyle;
+ delete m_pFooterStyle;
+ delete m_pBGImage;
}
enumXFStyle XFPageMaster::GetStyleFamily()
@@ -140,8 +134,7 @@ void XFPageMaster::SetBackColor(XFColor color)
void XFPageMaster::SetBackImage(XFBGImage *image)
{
- if( m_pBGImage )
- delete m_pBGImage;
+ delete m_pBGImage;
m_pBGImage = image;
}
diff --git a/lotuswordpro/source/filter/xfilter/xfparastyle.cxx b/lotuswordpro/source/filter/xfilter/xfparastyle.cxx
index 8364d1ae5c8b..701d057449f5 100644
--- a/lotuswordpro/source/filter/xfilter/xfparastyle.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfparastyle.cxx
@@ -136,7 +136,7 @@ XFParaStyle& XFParaStyle::operator=(const XFParaStyle& other)
if (this != &other)
{
// first , clean member
- delete(m_pBGImage);
+ delete m_pBGImage;
m_aTabs.Reset();
m_strParentStyleName = other.m_strParentStyleName;
@@ -186,10 +186,8 @@ XFParaStyle& XFParaStyle::operator=(const XFParaStyle& other)
XFParaStyle::~XFParaStyle()
{
- if( m_pBorders )
- delete m_pBorders;
- if( m_pBGImage )
- delete m_pBGImage;
+ delete m_pBorders;
+ delete m_pBGImage;
}
enumXFStyle XFParaStyle::GetStyleFamily()
@@ -234,15 +232,13 @@ void XFParaStyle::SetBackColor(XFColor& color)
void XFParaStyle::SetBackImage(XFBGImage *image)
{
- if( m_pBGImage )
- delete m_pBGImage;
+ delete m_pBGImage;
m_pBGImage = image;
}
void XFParaStyle::SetBorders(XFBorders *pBorders)
{
- if( m_pBorders )
- delete m_pBorders;
+ delete m_pBorders;
m_pBorders = pBorders;
}
diff --git a/lotuswordpro/source/filter/xfilter/xfrow.cxx b/lotuswordpro/source/filter/xfilter/xfrow.cxx
index 7f7a54078833..26c258174d50 100644
--- a/lotuswordpro/source/filter/xfilter/xfrow.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfrow.cxx
@@ -79,8 +79,7 @@ XFRow::~XFRow()
for( it=m_aCells.begin(); it!=m_aCells.end(); ++it )
{
XFCell *pCell = (*it).second;
- if( pCell )
- delete pCell;
+ delete pCell;
}
}
@@ -88,16 +87,6 @@ void XFRow::AddCell(XFCell *pCell)
{
if( !pCell )
return;
-/* sal_Int32 col = pCell->GetCol();
- if( col<1 )
- {
- pCell->SetCol(m_aCells.size()+1);
- }
-
- col = pCell->GetCol();
- if( m_aCells.find(col) != m_aCells.end() )
- delete m_aCells[col];
-*/
sal_Int32 col = m_aCells.size()+1;
pCell->SetCol(col);
pCell->SetOwnerRow(this);
diff --git a/lotuswordpro/source/filter/xfilter/xfrowstyle.cxx b/lotuswordpro/source/filter/xfilter/xfrowstyle.cxx
index ffeaa0603440..a8acfbadc490 100644
--- a/lotuswordpro/source/filter/xfilter/xfrowstyle.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfrowstyle.cxx
@@ -108,8 +108,7 @@ XFRowStyle& XFRowStyle::operator=(XFRowStyle const &other)
m_fMinHeight = other.m_fMinHeight;
m_aBackColor = other.m_aBackColor;
- if( m_pBGImage )
- delete m_pBGImage;
+ delete m_pBGImage;
if( other.m_pBGImage )
m_pBGImage = new XFBGImage(*other.m_pBGImage);
diff --git a/lotuswordpro/source/filter/xfilter/xfsaxstream.cxx b/lotuswordpro/source/filter/xfilter/xfsaxstream.cxx
index 9419630d4650..6a5bcd7ccc4a 100644
--- a/lotuswordpro/source/filter/xfilter/xfsaxstream.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfsaxstream.cxx
@@ -87,8 +87,7 @@ XFSaxStream::XFSaxStream(Reference<XDocumentHandler>& xHandler)
XFSaxStream::~XFSaxStream()
{
- if( m_pAttrList )
- delete m_pAttrList;
+ delete m_pAttrList;
}
void XFSaxStream::StartDocument()
diff --git a/lotuswordpro/source/filter/xfilter/xfsectionstyle.cxx b/lotuswordpro/source/filter/xfilter/xfsectionstyle.cxx
index dd04e8662054..cb9d5cf972f9 100644
--- a/lotuswordpro/source/filter/xfilter/xfsectionstyle.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfsectionstyle.cxx
@@ -70,10 +70,8 @@ XFSectionStyle::XFSectionStyle()
XFSectionStyle::~XFSectionStyle()
{
- if( m_pColumns )
- delete m_pColumns;
- if( m_pBackImage )
- delete m_pBackImage;
+ delete m_pColumns;
+ delete m_pBackImage;
}
enumXFStyle XFSectionStyle::GetStyleFamily()
@@ -93,8 +91,7 @@ void XFSectionStyle::SetMarginRight(double right)
void XFSectionStyle::SetColumns(XFColumns *pColumns)
{
- if( m_pColumns )
- delete m_pColumns;
+ delete m_pColumns;
m_pColumns = pColumns;
}
diff --git a/lotuswordpro/source/filter/xfilter/xfstylemanager.cxx b/lotuswordpro/source/filter/xfilter/xfstylemanager.cxx
index 6a31a9cd1f73..8704816b3fc3 100644
--- a/lotuswordpro/source/filter/xfilter/xfstylemanager.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfstylemanager.cxx
@@ -203,8 +203,7 @@ IXFStyleRet XFStyleManager::AddStyle(IXFStyle *pStyle)
}
else if( pStyle->GetStyleFamily() == enumXFStyleOutline )
{
- if( s_pOutlineStyle )
- delete s_pOutlineStyle;
+ delete s_pOutlineStyle;
s_pOutlineStyle = pStyle;
}
else if( pStyle->GetStyleFamily() == enumXFStyleStrokeDash )
diff --git a/lotuswordpro/source/filter/xfilter/xftablestyle.cxx b/lotuswordpro/source/filter/xfilter/xftablestyle.cxx
index 0fc87b216541..0e055515c25e 100644
--- a/lotuswordpro/source/filter/xfilter/xftablestyle.cxx
+++ b/lotuswordpro/source/filter/xfilter/xftablestyle.cxx
@@ -69,14 +69,12 @@ XFTableStyle::XFTableStyle()
XFTableStyle::~XFTableStyle()
{
- if( m_pBGImage )
- delete m_pBGImage;
+ delete m_pBGImage;
}
void XFTableStyle::SetBackImage(XFBGImage *pImage)
{
- if( m_pBGImage )
- delete m_pBGImage;
+ delete m_pBGImage;
m_pBGImage = pImage;
}