Commit: f891d4e2adae2dcf35497ba95a9cfb74affead0c Author: Sergey Sharybin Date: Fri Jul 3 16:32:12 2020 +0200 Branches: master https://developer.blender.org/rBf891d4e2adae2dcf35497ba95a9cfb74affead0c
Clang-Tidy: Fix readability-delete-null-pointer warnings Also enable it in the configuration. =================================================================== M .clang-tidy M source/blender/freestyle/intern/geometry/Bezier.cpp M source/blender/freestyle/intern/image/GaussianFilter.cpp M source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp M source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp M source/blender/freestyle/intern/python/BPy_Iterator.cpp M source/blender/freestyle/intern/python/BPy_StrokeShader.cpp M source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp M source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp M source/blender/freestyle/intern/python/BPy_ViewMap.cpp M source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp M source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp M source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp M source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp M source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp M source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp M source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp M source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp M source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp M source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp M source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp M source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp M source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp M source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp M source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp M source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp M source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp M source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp M source/blender/freestyle/intern/stroke/Canvas.cpp M source/blender/freestyle/intern/stroke/Stroke.cpp M source/blender/freestyle/intern/view_map/SteerableViewMap.cpp M source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp =================================================================== diff --git a/.clang-tidy b/.clang-tidy index 0d293156fec..d1287ff7875 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -20,7 +20,6 @@ Checks: > -readability-named-parameter, -readability-function-size, -readability-function-size, - -readability-delete-null-pointer, -readability-redundant-string-init, -readability-redundant-member-init, -readability-const-return-type, diff --git a/source/blender/freestyle/intern/geometry/Bezier.cpp b/source/blender/freestyle/intern/geometry/Bezier.cpp index 9a832c04699..4ae30ff893c 100644 --- a/source/blender/freestyle/intern/geometry/Bezier.cpp +++ b/source/blender/freestyle/intern/geometry/Bezier.cpp @@ -109,9 +109,7 @@ BezierCurve::~BezierCurve() delete *v; } } - if (_currentSegment) { - delete _currentSegment; - } + delete _currentSegment; } void BezierCurve::AddControlPoint(const Vec2d &iPoint) diff --git a/source/blender/freestyle/intern/image/GaussianFilter.cpp b/source/blender/freestyle/intern/image/GaussianFilter.cpp index 87e2caee8a9..ca476bee0d3 100644 --- a/source/blender/freestyle/intern/image/GaussianFilter.cpp +++ b/source/blender/freestyle/intern/image/GaussianFilter.cpp @@ -55,9 +55,7 @@ GaussianFilter &GaussianFilter::operator=(const GaussianFilter &iBrother) GaussianFilter::~GaussianFilter() { - if (0 != _mask) { - delete[] _mask; - } + delete[] _mask; } int GaussianFilter::computeMaskSize(float sigma) @@ -78,9 +76,7 @@ void GaussianFilter::setSigma(float sigma) void GaussianFilter::computeMask() { - if (0 != _mask) { - delete[] _mask; - } + delete[] _mask; _maskSize = computeMaskSize(_sigma); _storedMaskSize = (_maskSize + 1) >> 1; 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; - } + dele @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs