[colobot] 47/390: Remove unnecessary delete checks (#318)
Didier Raboud
odyx at moszumanska.debian.org
Fri Jun 12 14:21:26 UTC 2015
This is an automated email from the git hooks/post-receive script.
odyx pushed a commit to branch upstream/latest
in repository colobot.
commit ac019c263d7b41742934a9dafd58ac2e6171109c
Author: Piotr Dziwinski <piotrdz at gmail.com>
Date: Sat Aug 9 22:45:07 2014 +0200
Remove unnecessary delete checks (#318)
---
src/CBot/CBotToken.cpp | 2 +-
src/common/iman.cpp | 4 +---
src/common/singleton.h | 5 +----
src/sound/oalsound/alsound.cpp | 14 ++++----------
src/ui/interface.cpp | 7 ++-----
5 files changed, 9 insertions(+), 23 deletions(-)
diff --git a/src/CBot/CBotToken.cpp b/src/CBot/CBotToken.cpp
index 48033a3..17cdba1 100644
--- a/src/CBot/CBotToken.cpp
+++ b/src/CBot/CBotToken.cpp
@@ -105,7 +105,7 @@ void CBotToken::Free()
const CBotToken& CBotToken::operator=(const CBotToken& src)
{
- if (m_next != NULL) delete(m_next);
+ delete m_next;
m_next = NULL;
m_prev = NULL;
diff --git a/src/common/iman.cpp b/src/common/iman.cpp
index 88fbb9b..edfa9c7 100644
--- a/src/common/iman.cpp
+++ b/src/common/iman.cpp
@@ -42,9 +42,7 @@ void CInstanceManager::Flush()
{
for (int i = 0; i < CLASS_MAX; i++)
{
- if (m_table[i].instances != nullptr)
- delete[] m_table[i].instances;
-
+ delete[] m_table[i].instances;
m_table[i].instances = nullptr;
}
}
diff --git a/src/common/singleton.h b/src/common/singleton.h
index 841759d..bf5bc9d 100644
--- a/src/common/singleton.h
+++ b/src/common/singleton.h
@@ -62,10 +62,7 @@ public:
static void ReplaceInstance(T* newInstance)
{
assert(newInstance != nullptr);
-
- if (m_instance != nullptr)
- delete m_instance;
-
+ delete m_instance;
m_instance = newInstance;
}
#endif
diff --git a/src/sound/oalsound/alsound.cpp b/src/sound/oalsound/alsound.cpp
index 8afbdd2..327bb6f 100644
--- a/src/sound/oalsound/alsound.cpp
+++ b/src/sound/oalsound/alsound.cpp
@@ -58,20 +58,14 @@ void ALSound::CleanUp()
delete channel.second;
}
- if (m_currentMusic)
- {
- delete m_currentMusic;
- }
-
+ delete m_currentMusic;
+
for (auto item : m_oldMusic)
{
delete item.music;
}
-
- if (m_previousMusic.music)
- {
- delete m_previousMusic.music;
- }
+
+ delete m_previousMusic.music;
for (auto item : m_sounds)
{
diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp
index ab2c01b..4a0c221 100644
--- a/src/ui/interface.cpp
+++ b/src/ui/interface.cpp
@@ -49,11 +49,8 @@ void CInterface::Flush()
{
for (int i = 0; i < MAXCONTROL; i++)
{
- if (m_table[i] != nullptr)
- {
- delete m_table[i];
- m_table[i] = nullptr;
- }
+ delete m_table[i];
+ m_table[i] = nullptr;
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git
More information about the Pkg-games-commits
mailing list