diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2020-07-03 17:32:12 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2020-07-03 17:32:51 +0300 |
commit | f891d4e2adae2dcf35497ba95a9cfb74affead0c (patch) | |
tree | fddb5cad92ddbe5b22323ee0b011f1f95682c716 /source/blender/freestyle/intern/python | |
parent | 53d41e1a6fc4c521e412fba57913f93fadeb3735 (diff) |
Clang-Tidy: Fix readability-delete-null-pointer warnings
Also enable it in the configuration.
Diffstat (limited to 'source/blender/freestyle/intern/python')
25 files changed, 26 insertions, 75 deletions
diff --git a/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp b/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp index a631b45f6d4..42b13bf4920 100644 --- a/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp +++ b/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp @@ -84,9 +84,8 @@ static int BinaryPredicate0D___init__(BPy_BinaryPredicate0D *self, PyObject *arg static void BinaryPredicate0D___dealloc__(BPy_BinaryPredicate0D *self) { - if (self->bp0D) { - delete self->bp0D; - } + delete self->bp0D; + Py_TYPE(self)->tp_free((PyObject *)self); } diff --git a/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp b/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp index 9add706bea7..ed991695739 100644 --- a/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp +++ b/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp @@ -120,9 +120,7 @@ static int BinaryPredicate1D___init__(BPy_BinaryPredicate1D *self, PyObject *arg static void BinaryPredicate1D___dealloc__(BPy_BinaryPredicate1D *self) { - if (self->bp1D) { - delete self->bp1D; - } + delete self->bp1D; Py_TYPE(self)->tp_free((PyObject *)self); } diff --git a/source/blender/freestyle/intern/python/BPy_Iterator.cpp b/source/blender/freestyle/intern/python/BPy_Iterator.cpp index 6e00a05b969..b8dedb6497a 100644 --- a/source/blender/freestyle/intern/python/BPy_Iterator.cpp +++ b/source/blender/freestyle/intern/python/BPy_Iterator.cpp @@ -137,9 +137,7 @@ static int Iterator_init(BPy_Iterator *self, PyObject *args, PyObject *kwds) static void Iterator_dealloc(BPy_Iterator *self) { - if (self->it) { - delete self->it; - } + delete self->it; Py_TYPE(self)->tp_free((PyObject *)self); } diff --git a/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp b/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp index 993afc2e32e..5e5685153af 100644 --- a/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp +++ b/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp @@ -210,9 +210,7 @@ static int StrokeShader___init__(BPy_StrokeShader *self, PyObject *args, PyObjec static void StrokeShader___dealloc__(BPy_StrokeShader *self) { - if (self->ss) { - delete self->ss; - } + delete self->ss; Py_TYPE(self)->tp_free((PyObject *)self); } diff --git a/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp index 3d4191c2c44..ddbb55fdb4d 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp +++ b/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp @@ -97,9 +97,7 @@ static int UnaryPredicate0D___init__(BPy_UnaryPredicate0D *self, PyObject *args, static void UnaryPredicate0D___dealloc__(BPy_UnaryPredicate0D *self) { - if (self->up0D) { - delete self->up0D; - } + delete self->up0D; Py_TYPE(self)->tp_free((PyObject *)self); } diff --git a/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp index ba68d21f941..11e77fa365a 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp +++ b/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp @@ -155,9 +155,7 @@ static int UnaryPredicate1D___init__(BPy_UnaryPredicate1D *self, PyObject *args, static void UnaryPredicate1D___dealloc__(BPy_UnaryPredicate1D *self) { - if (self->up1D) { - delete self->up1D; - } + delete self->up1D; Py_TYPE(self)->tp_free((PyObject *)self); } diff --git a/source/blender/freestyle/intern/python/BPy_ViewMap.cpp b/source/blender/freestyle/intern/python/BPy_ViewMap.cpp index b7b425abe23..67a4249ade8 100644 --- a/source/blender/freestyle/intern/python/BPy_ViewMap.cpp +++ b/source/blender/freestyle/intern/python/BPy_ViewMap.cpp @@ -69,9 +69,7 @@ static int ViewMap_init(BPy_ViewMap *self, PyObject *args, PyObject *kwds) static void ViewMap_dealloc(BPy_ViewMap *self) { - if (self->vm) { - delete self->vm; - } + delete self->vm; Py_TYPE(self)->tp_free((PyObject *)self); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp index d1ea13c90a7..9ced91f6867 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp @@ -145,9 +145,7 @@ static int UnaryFunction0DDouble___init__(BPy_UnaryFunction0DDouble *self, static void UnaryFunction0DDouble___dealloc__(BPy_UnaryFunction0DDouble *self) { - if (self->uf0D_double) { - delete self->uf0D_double; - } + delete self->uf0D_double; UnaryFunction0D_Type.tp_dealloc((PyObject *)self); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp index 00600c405ef..7520f647276 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp @@ -83,9 +83,7 @@ static int UnaryFunction0DEdgeNature___init__(BPy_UnaryFunction0DEdgeNature *sel static void UnaryFunction0DEdgeNature___dealloc__(BPy_UnaryFunction0DEdgeNature *self) { - if (self->uf0D_edgenature) { - delete self->uf0D_edgenature; - } + delete self->uf0D_edgenature; UnaryFunction0D_Type.tp_dealloc((PyObject *)self); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp index 3961bf58bc4..7ee0d9bd71d 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp @@ -121,9 +121,7 @@ static int UnaryFunction0DFloat___init__(BPy_UnaryFunction0DFloat *self, static void UnaryFunction0DFloat___dealloc__(BPy_UnaryFunction0DFloat *self) { - if (self->uf0D_float) { - delete self->uf0D_float; - } + delete self->uf0D_float; UnaryFunction0D_Type.tp_dealloc((PyObject *)self); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp index 86e902bafe4..9c0f833d8fa 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp @@ -80,9 +80,7 @@ static int UnaryFunction0DId___init__(BPy_UnaryFunction0DId *self, PyObject *arg static void UnaryFunction0DId___dealloc__(BPy_UnaryFunction0DId *self) { - if (self->uf0D_id) { - delete self->uf0D_id; - } + delete self->uf0D_id; UnaryFunction0D_Type.tp_dealloc((PyObject *)self); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp index 551429add8b..95cdc1522ac 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp @@ -82,9 +82,7 @@ static int UnaryFunction0DMaterial___init__(BPy_UnaryFunction0DMaterial *self, static void UnaryFunction0DMaterial___dealloc__(BPy_UnaryFunction0DMaterial *self) { - if (self->uf0D_material) { - delete self->uf0D_material; - } + delete self->uf0D_material; UnaryFunction0D_Type.tp_dealloc((PyObject *)self); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp index 8721e820fee..17ddd9773d2 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp @@ -83,9 +83,7 @@ static int UnaryFunction0DUnsigned___init__(BPy_UnaryFunction0DUnsigned *self, static void UnaryFunction0DUnsigned___dealloc__(BPy_UnaryFunction0DUnsigned *self) { - if (self->uf0D_unsigned) { - delete self->uf0D_unsigned; - } + delete self->uf0D_unsigned; UnaryFunction0D_Type.tp_dealloc((PyObject *)self); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp index 44a39af68dd..3ff73dca832 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp @@ -89,9 +89,7 @@ static int UnaryFunction0DVec2f___init__(BPy_UnaryFunction0DVec2f *self, static void UnaryFunction0DVec2f___dealloc__(BPy_UnaryFunction0DVec2f *self) { - if (self->uf0D_vec2f) { - delete self->uf0D_vec2f; - } + delete self->uf0D_vec2f; UnaryFunction0D_Type.tp_dealloc((PyObject *)self); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp index 6a27fc6e140..afbd25df122 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp @@ -82,9 +82,7 @@ static int UnaryFunction0DVec3f___init__(BPy_UnaryFunction0DVec3f *self, static void UnaryFunction0DVec3f___dealloc__(BPy_UnaryFunction0DVec3f *self) { - if (self->uf0D_vec3f) { - delete self->uf0D_vec3f; - } + delete self->uf0D_vec3f; UnaryFunction0D_Type.tp_dealloc((PyObject *)self); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp index 88c050e243e..4fd6d949974 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp @@ -84,9 +84,7 @@ static int UnaryFunction0DVectorViewShape___init__(BPy_UnaryFunction0DVectorView static void UnaryFunction0DVectorViewShape___dealloc__(BPy_UnaryFunction0DVectorViewShape *self) { - if (self->uf0D_vectorviewshape) { - delete self->uf0D_vectorviewshape; - } + delete self->uf0D_vectorviewshape; UnaryFunction0D_Type.tp_dealloc((PyObject *)self); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp index 11f4e114342..0f623b0e765 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp @@ -90,9 +90,7 @@ static int UnaryFunction0DViewShape___init__(BPy_UnaryFunction0DViewShape *self, static void UnaryFunction0DViewShape___dealloc__(BPy_UnaryFunction0DViewShape *self) { - if (self->uf0D_viewshape) { - delete self->uf0D_viewshape; - } + delete self->uf0D_viewshape; UnaryFunction0D_Type.tp_dealloc((PyObject *)self); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp index fb887371c3a..88705c41204 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp @@ -197,9 +197,7 @@ static int UnaryFunction1DDouble___init__(BPy_UnaryFunction1DDouble *self, static void UnaryFunction1DDouble___dealloc__(BPy_UnaryFunction1DDouble *self) { - if (self->uf1D_double) { - delete self->uf1D_double; - } + delete self->uf1D_double; UnaryFunction1D_Type.tp_dealloc((PyObject *)self); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp index e2a55d49a06..3cfc5464296 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp @@ -103,9 +103,7 @@ static int UnaryFunction1DEdgeNature___init__(BPy_UnaryFunction1DEdgeNature *sel static void UnaryFunction1DEdgeNature___dealloc__(BPy_UnaryFunction1DEdgeNature *self) { - if (self->uf1D_edgenature) { - delete self->uf1D_edgenature; - } + delete self->uf1D_edgenature; UnaryFunction1D_Type.tp_dealloc((PyObject *)self); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp index 2eb4f9349da..4fdc68a2e89 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp @@ -93,9 +93,7 @@ static int UnaryFunction1DFloat___init__(BPy_UnaryFunction1DFloat *self, static void UnaryFunction1DFloat___dealloc__(BPy_UnaryFunction1DFloat *self) { - if (self->uf1D_float) { - delete self->uf1D_float; - } + delete self->uf1D_float; UnaryFunction1D_Type.tp_dealloc((PyObject *)self); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp index ff306652036..218afa3ff10 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp @@ -103,9 +103,7 @@ static int UnaryFunction1DUnsigned___init__(BPy_UnaryFunction1DUnsigned *self, static void UnaryFunction1DUnsigned___dealloc__(BPy_UnaryFunction1DUnsigned *self) { - if (self->uf1D_unsigned) { - delete self->uf1D_unsigned; - } + delete self->uf1D_unsigned; UnaryFunction1D_Type.tp_dealloc((PyObject *)self); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp index 1469b0a6e33..939ccfb8905 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp @@ -108,9 +108,7 @@ static int UnaryFunction1DVec2f___init__(BPy_UnaryFunction1DVec2f *self, static void UnaryFunction1DVec2f___dealloc__(BPy_UnaryFunction1DVec2f *self) { - if (self->uf1D_vec2f) { - delete self->uf1D_vec2f; - } + delete self->uf1D_vec2f; UnaryFunction1D_Type.tp_dealloc((PyObject *)self); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp index 63cd0584adb..02b6373cce4 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp @@ -101,9 +101,7 @@ static int UnaryFunction1DVec3f___init__(BPy_UnaryFunction1DVec3f *self, static void UnaryFunction1DVec3f___dealloc__(BPy_UnaryFunction1DVec3f *self) { - if (self->uf1D_vec3f) { - delete self->uf1D_vec3f; - } + delete self->uf1D_vec3f; UnaryFunction1D_Type.tp_dealloc((PyObject *)self); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp index cb94d6b75e2..b2020e9f554 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp @@ -118,9 +118,7 @@ static int UnaryFunction1DVectorViewShape___init__(BPy_UnaryFunction1DVectorView static void UnaryFunction1DVectorViewShape___dealloc__(BPy_UnaryFunction1DVectorViewShape *self) { - if (self->uf1D_vectorviewshape) { - delete self->uf1D_vectorviewshape; - } + delete self->uf1D_vectorviewshape; UnaryFunction1D_Type.tp_dealloc((PyObject *)self); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp index 216b1305556..7b25daa24f9 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp @@ -116,9 +116,7 @@ static int UnaryFunction1DVoid___init__(BPy_UnaryFunction1DVoid *self, static void UnaryFunction1DVoid___dealloc__(BPy_UnaryFunction1DVoid *self) { - if (self->uf1D_void) { - delete self->uf1D_void; - } + delete self->uf1D_void; UnaryFunction1D_Type.tp_dealloc((PyObject *)self); } |