From 4cfa653ed8ab41d6198eb5d02112b1c8465daaec Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Thu, 18 Feb 2016 21:09:00 +0300 Subject: [PATCH] Redundant checks have been removed --- src/lrbanddesignintf.cpp | 9 ++------- src/lrdatadesignintf.h | 2 +- src/lrreportengine.cpp | 5 ++--- src/lrscriptenginemanager.cpp | 6 ++---- src/objectinspector/lrobjectitemmodel.cpp | 3 +-- 5 files changed, 8 insertions(+), 17 deletions(-) diff --git a/src/lrbanddesignintf.cpp b/src/lrbanddesignintf.cpp index 32f8ba6..d4445dd 100644 --- a/src/lrbanddesignintf.cpp +++ b/src/lrbanddesignintf.cpp @@ -174,13 +174,8 @@ BandDesignIntf::~BandDesignIntf() // delete band; // } // } - - if (m_bandMarker) { - delete m_bandMarker; - } - if (m_bandNameLabel){ - delete m_bandNameLabel; - } + delete m_bandMarker; + delete m_bandNameLabel; } void BandDesignIntf::paint(QPainter *ppainter, const QStyleOptionGraphicsItem *option, QWidget *widget) diff --git a/src/lrdatadesignintf.h b/src/lrdatadesignintf.h index b0807a2..464f324 100644 --- a/src/lrdatadesignintf.h +++ b/src/lrdatadesignintf.h @@ -413,7 +413,7 @@ public: bool isEditable() const {return false;} bool isRemovable() const {return false;} void invalidate(IDataSource::DatasourceMode mode){Q_UNUSED(mode)} - ~CallbackDatasourceHolder(){if (m_datasource) delete m_datasource;} + ~CallbackDatasourceHolder(){delete m_datasource;} void update(){} void clearErrors(){} private: diff --git a/src/lrreportengine.cpp b/src/lrreportengine.cpp index 036d08c..373e627 100644 --- a/src/lrreportengine.cpp +++ b/src/lrreportengine.cpp @@ -220,8 +220,7 @@ void ReportEnginePrivate::printReport(ReportPages pages, QPrinter &printer, cons currenPage++; } - if (painter) delete painter; - + delete painter; } bool ReportEnginePrivate::printReport(QPrinter* printer) @@ -543,7 +542,7 @@ ReportEngine::ReportEngine(QObject *parent) ReportEngine::~ReportEngine() { - if (d_ptr) delete d_ptr; + delete d_ptr; } bool ReportEngine::printReport(QPrinter *printer) diff --git a/src/lrscriptenginemanager.cpp b/src/lrscriptenginemanager.cpp index dbd701d..3e40700 100644 --- a/src/lrscriptenginemanager.cpp +++ b/src/lrscriptenginemanager.cpp @@ -268,10 +268,8 @@ QScriptValue groupFunction(QScriptContext* pcontext, QScriptEngine* pengine){ ScriptEngineManager::~ScriptEngineManager() { - if (m_model){ - delete m_model; - m_model=0; - } + delete m_model; + m_model = 0; delete m_scriptEngine; } diff --git a/src/objectinspector/lrobjectitemmodel.cpp b/src/objectinspector/lrobjectitemmodel.cpp index af642ea..d658927 100644 --- a/src/objectinspector/lrobjectitemmodel.cpp +++ b/src/objectinspector/lrobjectitemmodel.cpp @@ -91,8 +91,7 @@ QObjectPropertyModel::QObjectPropertyModel(QObject *parent/*=0*/) QObjectPropertyModel::~QObjectPropertyModel() { - if (m_rootNode) - delete m_rootNode; + delete m_rootNode; } void QObjectPropertyModel::initModel()