summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2006-03-19 21:40:21 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2006-03-19 21:40:21 +0000
commit0f55757c602c7fec723f73e5820ec936d24cd826 (patch)
tree6bd5d5eb110441ca6ddc4a01d90f4cf2d50af387
parent654d24e74c56d240b8d622840c135e22a029636d (diff)
downloadmana-0f55757c602c7fec723f73e5820ec936d24cd826.tar.gz
mana-0f55757c602c7fec723f73e5820ec936d24cd826.tar.bz2
mana-0f55757c602c7fec723f73e5820ec936d24cd826.tar.xz
mana-0f55757c602c7fec723f73e5820ec936d24cd826.zip
Removed some useless null pointer checks.
-rw-r--r--ChangeLog4
-rw-r--r--src/game.cpp7
-rw-r--r--src/gui/browserbox.cpp6
-rw-r--r--src/gui/gui.cpp5
-rw-r--r--src/gui/register.cpp6
-rw-r--r--src/lockedarray.h3
-rw-r--r--src/resources/resourcemanager.cpp6
7 files changed, 13 insertions, 24 deletions
diff --git a/ChangeLog b/ChangeLog
index 9c0a1f2a..7bf2662e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2006-03-19 Björn Steinbrink <B.Steinbrink@gmx.de>
+ * src/lockedarray.h, src/game.cpp, src/gui/gui.cpp,
+ src/gui/browserbox.cpp, src/gui/register.cpp,
+ src/resources/resourcemanager.cpp: Removed some useless null pointer
+ checks.
* src/gui/login.cpp, src/gui/setup_audio.h, src/gui/setup.cpp,
src/gui/setup_audio.cpp, src/gui/setup_video.cpp,
src/gui/setup_video.h: Removed some duplicated initializations.
diff --git a/src/game.cpp b/src/game.cpp
index a780c2d7..f8812b81 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -308,14 +308,11 @@ Game::~Game()
delete beingManager;
delete floorItemManager;
+ delete joystick;
beingManager = NULL;
floorItemManager = NULL;
-
- if (joystick != NULL)
- {
- delete joystick;
- }
+ joystick = NULL;
}
bool saveScreenshot(SDL_Surface *screenshot)
diff --git a/src/gui/browserbox.cpp b/src/gui/browserbox.cpp
index 1f67670e..06660cd5 100644
--- a/src/gui/browserbox.cpp
+++ b/src/gui/browserbox.cpp
@@ -72,10 +72,8 @@ BrowserBox::~BrowserBox()
if (instances == 0)
{
// Clean up static resource font
- if (browserFont) {
- delete browserFont;
- browserFont = NULL;
- }
+ delete browserFont;
+ browserFont = NULL;
}
#endif
}
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 7a57cd00..cb79e54b 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -193,10 +193,7 @@ Gui::~Gui()
delete speechFont;
delete mTop;
delete mImageLoader;
-
- if (mHostImageLoader) {
- delete mHostImageLoader;
- }
+ delete mHostImageLoader;
delete guiInput;
}
diff --git a/src/gui/register.cpp b/src/gui/register.cpp
index 39c918f7..c9b9daa7 100644
--- a/src/gui/register.cpp
+++ b/src/gui/register.cpp
@@ -198,11 +198,7 @@ RegisterDialog::action(const std::string& eventId)
mConfirmField->setText("");
}
- if (mWrongRegisterNotice)
- {
- delete mWrongRegisterNotice;
- mWrongRegisterNotice = NULL;
- }
+ delete mWrongRegisterNotice;
mWrongRegisterNotice = new OkDialog("Error", errorMsg.str());
mWrongRegisterNotice->addActionListener(mWrongDataNoticeListener);
}
diff --git a/src/lockedarray.h b/src/lockedarray.h
index 13cbbda7..7ec2f9da 100644
--- a/src/lockedarray.h
+++ b/src/lockedarray.h
@@ -74,8 +74,7 @@ LockedArray<T>::LockedArray(unsigned int size):
template<class T>
LockedArray<T>::~LockedArray()
{
- if (mData)
- delete [] mData;
+ delete [] mData;
}
template<class T>
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index 09102d2e..1cdf5a65 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -240,10 +240,8 @@ ResourceManager::getInstance()
void
ResourceManager::deleteInstance()
{
- if (instance != NULL) {
- delete instance;
- instance = NULL;
- }
+ delete instance;
+ instance = NULL;
}
void*