[PATCH 01/13] Remove useless checks for null pointer before delete.
Vincent Ordy
vincent at ordy.net
Thu Jun 17 18:15:54 CEST 2010
---
kmymoney/converter/mymoneyqifreader.cpp | 3 +--
kmymoney/converter/mymoneystatementreader.cpp | 4 +---
kmymoney/dialogs/kgeneratesqldlg.cpp | 9 ++++-----
kmymoney/dialogs/kselectdatabasedlg.cpp | 2 +-
4 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/kmymoney/converter/mymoneyqifreader.cpp b/kmymoney/converter/mymoneyqifreader.cpp
index 5998ee9..53c6588 100644
--- a/kmymoney/converter/mymoneyqifreader.cpp
+++ b/kmymoney/converter/mymoneyqifreader.cpp
@@ -259,8 +259,7 @@ MyMoneyQifReader::MyMoneyQifReader() :
MyMoneyQifReader::~MyMoneyQifReader()
{
- if (m_file)
- delete m_file;
+ delete m_file;
delete d;
}
diff --git a/kmymoney/converter/mymoneystatementreader.cpp b/kmymoney/converter/mymoneystatementreader.cpp
index 7c71b6a..4812bb1 100644
--- a/kmymoney/converter/mymoneystatementreader.cpp
+++ b/kmymoney/converter/mymoneystatementreader.cpp
@@ -907,9 +907,7 @@ void MyMoneyStatementReader::processTransactionEntry(const MyMoneyStatement::Tra
if (accountCombo && !accountCombo->getSelected().isEmpty()) {
accountId = accountCombo->getSelected();
}
- if (dialog) {
- delete dialog;
- }
+ delete dialog;
//if they hit yes instead of no, then grab setting of account combo
if (result == KDialog::Yes) {
payee.setDefaultAccountId(accountId);
diff --git a/kmymoney/dialogs/kgeneratesqldlg.cpp b/kmymoney/dialogs/kgeneratesqldlg.cpp
index 3af7a0c..7f5c7e8 100644
--- a/kmymoney/dialogs/kgeneratesqldlg.cpp
+++ b/kmymoney/dialogs/kgeneratesqldlg.cpp
@@ -60,15 +60,14 @@ KGenerateSqlDlg::KGenerateSqlDlg(QWidget *)
KGenerateSqlDlg::~KGenerateSqlDlg()
{
- if (m_requiredFields != 0) delete m_requiredFields;
+ delete m_requiredFields;
}
void KGenerateSqlDlg::initializeForm()
{
- if (m_requiredFields != 0) {
- delete m_requiredFields;
- m_requiredFields = 0;
- }
+ delete m_requiredFields;
+ m_requiredFields = 0;
+
// at this point, we don't know which fields are required, so disable everything but the list
button(saveSQL)->setEnabled(false);
button(createTables)->setEnabled(false);
diff --git a/kmymoney/dialogs/kselectdatabasedlg.cpp b/kmymoney/dialogs/kselectdatabasedlg.cpp
index 71b22a3..822b7b0 100644
--- a/kmymoney/dialogs/kselectdatabasedlg.cpp
+++ b/kmymoney/dialogs/kselectdatabasedlg.cpp
@@ -60,7 +60,7 @@ KSelectDatabaseDlg::KSelectDatabaseDlg(int openMode, KUrl openURL, QWidget *)
KSelectDatabaseDlg::~KSelectDatabaseDlg()
{
- if (m_requiredFields != 0) delete m_requiredFields;
+ delete m_requiredFields;
}
bool KSelectDatabaseDlg::checkDrivers()
--
1.7.1
--------------060703030708080806090607
Content-Type: text/x-diff;
name="0002-Remove-useless-variable.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="0002-Remove-useless-variable.patch"
More information about the KMyMoney-devel
mailing list