[Bf-blender-cvs] [9739fc4d1bd] master: Clang-Tidy: More fixed of redundant check before delete

Sergey Sharybin noreply at git.blender.org
Fri Jul 3 16:48:04 CEST 2020


Commit: 9739fc4d1bd78283cbe3711e2aa9a38629791741
Author: Sergey Sharybin
Date:   Fri Jul 3 16:44:46 2020 +0200
Branches: master
https://developer.blender.org/rB9739fc4d1bd78283cbe3711e2aa9a38629791741

Clang-Tidy: More fixed of redundant check before delete

For some reason got unnoticed in the original cleanup pass.

===================================================================

M	source/blender/compositor/operations/COM_NormalizeOperation.cpp
M	source/blender/compositor/operations/COM_TonemapOperation.cpp
M	source/blender/depsgraph/intern/node/deg_node_component.cc
M	source/blender/ikplugin/intern/itasc_plugin.cpp
M	source/blender/imbuf/intern/dds/Image.cpp
M	source/blender/io/collada/collada_utils.cpp

===================================================================

diff --git a/source/blender/compositor/operations/COM_NormalizeOperation.cpp b/source/blender/compositor/operations/COM_NormalizeOperation.cpp
index f7e689fa008..55faa480b83 100644
--- a/source/blender/compositor/operations/COM_NormalizeOperation.cpp
+++ b/source/blender/compositor/operations/COM_NormalizeOperation.cpp
@@ -53,9 +53,7 @@ void NormalizeOperation::executePixel(float output[4], int x, int y, void *data)
 void NormalizeOperation::deinitExecution()
 {
   this->m_imageReader = NULL;
-  if (this->m_cachedInstance) {
-    delete this->m_cachedInstance;
-  }
+  delete this->m_cachedInstance;
   NodeOperation::deinitMutex();
 }
 
diff --git a/source/blender/compositor/operations/COM_TonemapOperation.cpp b/source/blender/compositor/operations/COM_TonemapOperation.cpp
index 417fe8713ed..59354ff7581 100644
--- a/source/blender/compositor/operations/COM_TonemapOperation.cpp
+++ b/source/blender/compositor/operations/COM_TonemapOperation.cpp
@@ -85,9 +85,7 @@ void PhotoreceptorTonemapOperation::executePixel(float output[4], int x, int y,
 void TonemapOperation::deinitExecution()
 {
   this->m_imageReader = NULL;
-  if (this->m_cachedInstance) {
-    delete this->m_cachedInstance;
-  }
+  delete this->m_cachedInstance;
   NodeOperation::deinitMutex();
 }
 
diff --git a/source/blender/depsgraph/intern/node/deg_node_component.cc b/source/blender/depsgraph/intern/node/deg_node_component.cc
index 490598af8f9..34514ba9bd7 100644
--- a/source/blender/depsgraph/intern/node/deg_node_component.cc
+++ b/source/blender/depsgraph/intern/node/deg_node_component.cc
@@ -98,9 +98,7 @@ void ComponentNode::init(const ID * /*id*/, const char * /*subdata*/)
 ComponentNode::~ComponentNode()
 {
   clear_operations();
-  if (operations_map != nullptr) {
-    delete operations_map;
-  }
+  delete operations_map;
 }
 
 string ComponentNode::identifier() const
diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp
index 66ed0dd0fa5..8f84d04f602 100644
--- a/source/blender/ikplugin/intern/itasc_plugin.cpp
+++ b/source/blender/ikplugin/intern/itasc_plugin.cpp
@@ -117,12 +117,8 @@ struct IK_Target {
   }
   ~IK_Target()
   {
-    if (constraint) {
-      delete constraint;
-    }
-    if (target) {
-      delete target;
-    }
+    delete constraint;
+    delete target;
   }
 };
 
@@ -196,29 +192,17 @@ struct IK_Scene {
   ~IK_Scene()
   {
     // delete scene first
-    if (scene) {
-      delete scene;
-    }
+    delete scene;
     for (std::vector<IK_Target *>::iterator it = targets.begin(); it != targets.end(); ++it) {
       delete (*it);
     }
     targets.clear();
-    if (channels) {
-      delete[] channels;
-    }
-    if (solver) {
-      delete solver;
-    }
-    if (armature) {
-      delete armature;
-    }
-    if (base) {
-      delete base;
-    }
+    delete[] channels;
+    delete solver;
+    delete armature;
+    delete base;
     // delete cache last
-    if (cache) {
-      delete cache;
-    }
+    delete cache;
   }
 };
 
diff --git a/source/blender/imbuf/intern/dds/Image.cpp b/source/blender/imbuf/intern/dds/Image.cpp
index d08a61a5a60..31a9927557b 100644
--- a/source/blender/imbuf/intern/dds/Image.cpp
+++ b/source/blender/imbuf/intern/dds/Image.cpp
@@ -51,9 +51,7 @@ void Image::allocate(uint w, uint h)
 
 void Image::free()
 {
-  if (m_data) {
-    delete[] m_data;
-  }
+  delete[] m_data;
   m_data = NULL;
 }
 
diff --git a/source/blender/io/collada/collada_utils.cpp b/source/blender/io/collada/collada_utils.cpp
index d2e05c7ae5b..e74808df466 100644
--- a/source/blender/io/collada/collada_utils.cpp
+++ b/source/blender/io/collada/collada_utils.cpp
@@ -528,9 +528,7 @@ BoneExtensionManager::~BoneExtensionManager()
     for (BoneExtensionMap::iterator ext_it = extended_bones->begin();
          ext_it != extended_bones->end();
          ++ext_it) {
-      if (ext_it->second != NULL) {
-        delete ext_it->second;
-      }
+      delete ext_it->second;
     }
     extended_bones->clear();
     delete extended_bones;



More information about the Bf-blender-cvs mailing list