Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove delete null checks
Not needed either.
  • Loading branch information
pvuorela committed Apr 7, 2021
1 parent fd7cc60 commit 67f7c28
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 56 deletions.
12 changes: 4 additions & 8 deletions libbuteosyncfw/common/NetworkManager.cpp
Expand Up @@ -118,14 +118,10 @@ NetworkManager::NetworkManager(QObject *parent /* = 0*/) :
NetworkManager::~NetworkManager()
{
FUNCTION_CALL_TRACE;
if (m_networkSession) {
delete m_networkSession;
m_networkSession = 0;
}
if (m_networkConfigManager) {
delete m_networkConfigManager;
m_networkConfigManager = 0;
}
delete m_networkSession;
m_networkSession = 0;
delete m_networkConfigManager;
m_networkConfigManager = 0;
}

bool NetworkManager::isOnline()
Expand Down
6 changes: 2 additions & 4 deletions libbuteosyncfw/pluginmgr/OOPClientPlugin.cpp
Expand Up @@ -83,10 +83,8 @@ OOPClientPlugin::OOPClientPlugin(const QString &aPluginName,

OOPClientPlugin::~OOPClientPlugin()
{
if (iOopPluginIface) {
delete iOopPluginIface;
iOopPluginIface = 0;
}
delete iOopPluginIface;
iOopPluginIface = 0;
}

bool OOPClientPlugin::init()
Expand Down
7 changes: 2 additions & 5 deletions libbuteosyncfw/pluginmgr/OOPServerPlugin.cpp
Expand Up @@ -81,11 +81,8 @@ OOPServerPlugin::OOPServerPlugin(const QString &aPluginName,
OOPServerPlugin::~OOPServerPlugin()
{
FUNCTION_CALL_TRACE;

if (iOopPluginIface) {
delete iOopPluginIface;
iOopPluginIface = 0;
}
delete iOopPluginIface;
iOopPluginIface = 0;
}

bool OOPServerPlugin::init()
Expand Down
6 changes: 2 additions & 4 deletions msyncd/ClientPluginRunner.cpp
Expand Up @@ -55,10 +55,8 @@ ClientPluginRunner::~ClientPluginRunner()
iPlugin = 0;
}

if (iThread != 0) {
delete iThread;
iThread = 0;
}
delete iThread;
iThread = 0;
}

bool ClientPluginRunner::init()
Expand Down
7 changes: 2 additions & 5 deletions msyncd/SyncAlarmInventory.cpp
Expand Up @@ -90,11 +90,8 @@ SyncAlarmInventory::~SyncAlarmInventory()
iDbHandle = QSqlDatabase();
QSqlDatabase::removeDatabase(iConnectionName);

if (iTimer) {
iTimer->stop();
delete iTimer;
iTimer = 0;
}
delete iTimer;
iTimer = 0;
}

int SyncAlarmInventory::addAlarm(QDateTime alarmDate)
Expand Down
6 changes: 2 additions & 4 deletions msyncd/SyncScheduler.cpp
Expand Up @@ -70,10 +70,8 @@ SyncScheduler::~SyncScheduler()
iBackgroundActivity->removeAll();
#else
removeAllAlarms();
if (iAlarmInventory) {
delete iAlarmInventory;
iAlarmInventory = 0;
}
delete iAlarmInventory;
iAlarmInventory = 0;
#endif
}

Expand Down
12 changes: 4 additions & 8 deletions msyncd/SyncSigHandler.cpp
Expand Up @@ -64,14 +64,10 @@ SyncSigHandler::SyncSigHandler(QObject *aParent, const char */*aName*/)
SyncSigHandler::~SyncSigHandler()
{
FUNCTION_CALL_TRACE;
if (iSigHup) {
delete iSigHup;
iSigHup = 0;
}
if (iSigTerm) {
delete iSigTerm;
iSigTerm = 0;
}
delete iSigHup;
iSigHup = 0;
delete iSigTerm;
iSigTerm = 0;
}

// Linux signal handler.
Expand Down
6 changes: 2 additions & 4 deletions msyncd/main.cpp
Expand Up @@ -111,10 +111,8 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
delete synchronizer;
synchronizer = 0;

if (sigHandler) {
delete sigHandler;
sigHandler = 0;
}
delete sigHandler;
sigHandler = 0;

LOG_DEBUG("Stopping logger");

Expand Down
7 changes: 2 additions & 5 deletions msyncd/synchronizer.cpp
Expand Up @@ -97,11 +97,8 @@ Synchronizer::Synchronizer(QCoreApplication *aApplication)
Synchronizer::~Synchronizer()
{
FUNCTION_CALL_TRACE;
//Clearing syncUiinterface
if (iSyncUIInterface) {
delete iSyncUIInterface;
iSyncUIInterface = NULL;
}
delete iSyncUIInterface;
iSyncUIInterface = NULL;
g_object_unref(iSettings);
delete iBatteryInfo;
}
Expand Down
7 changes: 2 additions & 5 deletions oopp-runner/PluginCbImpl.cpp
Expand Up @@ -40,11 +40,8 @@ PluginCbImpl::PluginCbImpl()
PluginCbImpl::~PluginCbImpl()
{
FUNCTION_CALL_TRACE;

if (imsyncIface) {
delete imsyncIface;
imsyncIface = 0;
}
delete imsyncIface;
imsyncIface = 0;
}

bool PluginCbImpl::requestStorage(const QString &aStorageName,
Expand Down
6 changes: 2 additions & 4 deletions oopp-runner/PluginServiceObj.cpp
Expand Up @@ -47,10 +47,8 @@ PluginServiceObj::PluginServiceObj(const QString &aPluginName,

PluginServiceObj::~PluginServiceObj()
{
if (iPlugin) {
delete iPlugin;
iPlugin = nullptr;
}
delete iPlugin;
iPlugin = nullptr;

delete iPluginCb;
}
Expand Down

0 comments on commit 67f7c28

Please sign in to comment.