summaryrefslogtreecommitdiff
path: root/idlc
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 /idlc
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 'idlc')
-rw-r--r--idlc/source/astexpression.cxx12
-rw-r--r--idlc/source/idlc.cxx21
2 files changed, 10 insertions, 23 deletions
diff --git a/idlc/source/astexpression.cxx b/idlc/source/astexpression.cxx
index fffeadf49b3e..ceda954a53d2 100644
--- a/idlc/source/astexpression.cxx
+++ b/idlc/source/astexpression.cxx
@@ -122,14 +122,10 @@ AstExpression::AstExpression(OString* scopedName)
AstExpression::~AstExpression()
{
- if ( m_exprValue )
- delete m_exprValue;
- if ( m_subExpr1 )
- delete m_subExpr1;
- if ( m_subExpr2 )
- delete m_subExpr2;
- if ( m_pSymbolicName )
- delete m_pSymbolicName;
+ delete m_exprValue;
+ delete m_subExpr1;
+ delete m_subExpr2;
+ delete m_pSymbolicName;
}
/*
diff --git a/idlc/source/idlc.cxx b/idlc/source/idlc.cxx
index 27cb47d93423..94d152501a01 100644
--- a/idlc/source/idlc.cxx
+++ b/idlc/source/idlc.cxx
@@ -218,19 +218,14 @@ Idlc::Idlc(Options* pOptions)
Idlc::~Idlc()
{
- if (m_pRoot)
- delete m_pRoot;
- if (m_pScopes)
- delete m_pScopes;
- if (m_pErrorHandler)
- delete m_pErrorHandler;
+ delete m_pRoot;
+ delete m_pScopes;
+ delete m_pErrorHandler;
}
void Idlc::init()
{
- if ( m_pRoot )
- delete m_pRoot;
-
+ delete m_pRoot;
m_pRoot = new AstModule(NT_root, OString(), NULL);
// push the root node on the stack
@@ -256,8 +251,7 @@ void Idlc::reset()
m_documentation.clear();
m_pScopes->clear();
- if ( m_pRoot)
- delete m_pRoot;
+ delete m_pRoot;
m_pRoot = new AstModule(NT_root, OString(), NULL);
@@ -363,10 +357,7 @@ Idlc* SAL_CALL idlc()
Idlc* SAL_CALL setIdlc(Options* pOptions)
{
- if ( pStaticIdlc )
- {
- delete pStaticIdlc;
- }
+ delete pStaticIdlc;
pStaticIdlc = new Idlc(pOptions);
pStaticIdlc->init();
return pStaticIdlc;