Clang-Tidy: Fix readability-delete-null-pointer warnings
Also enable it in the configuration.
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -109,9 +109,7 @@ BezierCurve::~BezierCurve()
|
||||
delete *v;
|
||||
}
|
||||
}
|
||||
if (_currentSegment) {
|
||||
delete _currentSegment;
|
||||
}
|
||||
delete _currentSegment;
|
||||
}
|
||||
|
||||
void BezierCurve::AddControlPoint(const Vec2d &iPoint)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -90,9 +90,7 @@ Canvas::~Canvas()
|
||||
}
|
||||
_maps.clear();
|
||||
}
|
||||
if (_steerableViewMap) {
|
||||
delete _steerableViewMap;
|
||||
}
|
||||
delete _steerableViewMap;
|
||||
}
|
||||
|
||||
void Canvas::preDraw()
|
||||
|
||||
@@ -484,9 +484,7 @@ Stroke &Stroke::operator=(const Stroke &iBrother)
|
||||
_id = iBrother._id;
|
||||
_ViewEdges = iBrother._ViewEdges;
|
||||
_sampling = iBrother._sampling;
|
||||
if (_rep) {
|
||||
delete _rep;
|
||||
}
|
||||
delete _rep;
|
||||
if (iBrother._rep) {
|
||||
_rep = new StrokeRep(*(iBrother._rep));
|
||||
}
|
||||
|
||||
@@ -193,9 +193,7 @@ void SteerableViewMap::buildImagesPyramids(GrayImage **steerableBases,
|
||||
{
|
||||
for (unsigned int i = 0; i <= _nbOrientations; ++i) {
|
||||
ImagePyramid *svm = (_imagesPyramids)[i];
|
||||
if (svm) {
|
||||
delete svm;
|
||||
}
|
||||
delete svm;
|
||||
if (copy) {
|
||||
svm = new GaussianPyramid(*(steerableBases[i]), iNbLevels, iSigma);
|
||||
}
|
||||
|
||||
@@ -66,9 +66,7 @@ void WingedEdgeBuilder::visitNodeTransform(NodeTransform &tn)
|
||||
|
||||
void WingedEdgeBuilder::visitNodeTransformAfter(NodeTransform &)
|
||||
{
|
||||
if (_current_matrix) {
|
||||
delete _current_matrix;
|
||||
}
|
||||
delete _current_matrix;
|
||||
|
||||
if (_matrices_stack.empty()) {
|
||||
_current_matrix = NULL;
|
||||
|
||||
Reference in New Issue
Block a user