diff --git a/src/client.cpp b/src/client.cpp index 56e35ac1f..1f6f64ce0 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -490,10 +490,8 @@ void Client::step(float dtime) MapBlock *block = m_env.getMap().getBlockNoCreateNoEx(r.p); if (block) { // Delete the old mesh - if (block->mesh != NULL) { - delete block->mesh; - block->mesh = NULL; - } + delete block->mesh; + block->mesh = NULL; if (r.mesh) { minimap_mapblock = r.mesh->moveMinimapMapblock(); diff --git a/src/client/clientlauncher.cpp b/src/client/clientlauncher.cpp index aeab82512..76d879725 100644 --- a/src/client/clientlauncher.cpp +++ b/src/client/clientlauncher.cpp @@ -53,14 +53,11 @@ MainGameCallback *g_gamecallback = NULL; ClientLauncher::~ClientLauncher() { - if (receiver) - delete receiver; + delete receiver; - if (input) - delete input; + delete input; - if (g_fontengine) - delete g_fontengine; + delete g_fontengine; if (device) device->drop(); diff --git a/src/game.cpp b/src/game.cpp index 3b5f1f382..ed7316a4d 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -3231,8 +3231,7 @@ void Game::processClientEvents(CameraOrientation *cam) { HudElement *e = player->removeHud(event.hudrm.id); - if (e != NULL) - delete e; + delete e; } break; diff --git a/src/guiFormSpecMenu.cpp b/src/guiFormSpecMenu.cpp index 888536128..e73f02e5c 100644 --- a/src/guiFormSpecMenu.cpp +++ b/src/guiFormSpecMenu.cpp @@ -134,13 +134,8 @@ GUIFormSpecMenu::~GUIFormSpecMenu() } delete m_selected_item; - - if (m_form_src != NULL) { - delete m_form_src; - } - if (m_text_dst != NULL) { - delete m_text_dst; - } + delete m_form_src; + delete m_text_dst; } void GUIFormSpecMenu::removeChildren() diff --git a/src/guiFormSpecMenu.h b/src/guiFormSpecMenu.h index bf0b4f356..d08bb4ab5 100644 --- a/src/guiFormSpecMenu.h +++ b/src/guiFormSpecMenu.h @@ -310,18 +310,14 @@ public: // form_src is deleted by this GUIFormSpecMenu void setFormSource(IFormSource *form_src) { - if (m_form_src != NULL) { - delete m_form_src; - } + delete m_form_src; m_form_src = form_src; } // text_dst is deleted by this GUIFormSpecMenu void setTextDest(TextDest *text_dst) { - if (m_text_dst != NULL) { - delete m_text_dst; - } + delete m_text_dst; m_text_dst = text_dst; } diff --git a/src/itemdef.cpp b/src/itemdef.cpp index 51d8f1d5d..53b6e04cd 100644 --- a/src/itemdef.cpp +++ b/src/itemdef.cpp @@ -112,11 +112,8 @@ void ItemDefinition::reset() stack_max = 99; usable = false; liquids_pointable = false; - if(tool_capabilities) - { - delete tool_capabilities; - tool_capabilities = NULL; - } + delete tool_capabilities; + tool_capabilities = NULL; groups.clear(); sound_place = SimpleSoundSpec(); sound_place_failed = SimpleSoundSpec(); diff --git a/src/mapblock.cpp b/src/mapblock.cpp index ec10a49bb..f36117059 100644 --- a/src/mapblock.cpp +++ b/src/mapblock.cpp @@ -97,16 +97,12 @@ MapBlock::~MapBlock() { //MutexAutoLock lock(mesh_mutex); - if(mesh) - { - delete mesh; - mesh = NULL; - } + delete mesh; + mesh = NULL; } #endif - if(data) - delete[] data; + delete[] data; } bool MapBlock::isValidPositionParent(v3s16 p) diff --git a/src/mesh_generator_thread.cpp b/src/mesh_generator_thread.cpp index dce788a7c..d95506de1 100644 --- a/src/mesh_generator_thread.cpp +++ b/src/mesh_generator_thread.cpp @@ -40,8 +40,7 @@ CachedMapBlockData::~CachedMapBlockData() { assert(refcount_from_queue == 0); - if (data) - delete[] data; + delete[] data; } /* @@ -60,8 +59,7 @@ QueuedMeshUpdate::QueuedMeshUpdate(): QueuedMeshUpdate::~QueuedMeshUpdate() { - if (data) - delete data; + delete data; } /* diff --git a/src/util/pointer.h b/src/util/pointer.h index 6614ca2c2..f68269882 100644 --- a/src/util/pointer.h +++ b/src/util/pointer.h @@ -97,8 +97,7 @@ public: private: void drop() { - if(data) - delete[] data; + delete[] data; } T *data; unsigned int m_size; @@ -214,8 +213,7 @@ private: (*refcount)--; if(*refcount == 0) { - if(data) - delete[] data; + delete[] data; delete refcount; } } diff --git a/src/util/srp.cpp b/src/util/srp.cpp index 430ba1137..e0ddb9020 100644 --- a/src/util/srp.cpp +++ b/src/util/srp.cpp @@ -861,7 +861,7 @@ err_exit: mpz_clear(usr->a); mpz_clear(usr->A); mpz_clear(usr->S); - if (usr->ng) delete_ng(usr->ng); + delete_ng(usr->ng); srp_free(usr->username); srp_free(usr->username_verifier); if (usr->password) {