From 90abdf27529a9f7b3afbb0c41d3045b1fdec3b58 Mon Sep 17 00:00:00 2001 From: Uwe Date: Mon, 18 Jul 2022 13:07:16 +0200 Subject: [PATCH] [Base] remove some more superfluous nullptr checks --- src/App/Range.cpp | 4 ++-- src/Base/Exception.cpp | 2 +- src/Base/Interpreter.cpp | 2 +- src/Base/Parameter.cpp | 2 +- src/Base/PyObjectBase.cpp | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/App/Range.cpp b/src/App/Range.cpp index d3391c91a9..e019131b3b 100644 --- a/src/App/Range.cpp +++ b/src/App/Range.cpp @@ -42,7 +42,7 @@ Range::Range(const char * range, bool normalize) std::string from; std::string to; - assert(range != nullptr); + assert(range); if (!strchr(range, ':')) { from = range; @@ -221,7 +221,7 @@ int App::validColumn(const std::string &colstr) App::CellAddress App::stringToAddress(const char * strAddress, bool silent) { - assert(strAddress != nullptr); + assert(strAddress); static boost::regex e("(\\$?[A-Z]{1,2})(\\$?[0-9]{1,5})"); boost::cmatch cm; diff --git a/src/Base/Exception.cpp b/src/Base/Exception.cpp index 3e91b74f96..bfdc7694cd 100644 --- a/src/Base/Exception.cpp +++ b/src/Base/Exception.cpp @@ -344,7 +344,7 @@ PyObject * FileException::getPyObject() void FileException::setPyObject( PyObject * pydict) { - if (pydict!=nullptr) { + if (pydict) { Exception::setPyObject(pydict); Py::Dict edict(pydict); diff --git a/src/Base/Interpreter.cpp b/src/Base/Interpreter.cpp index 8fb406aea0..1a2b26e9fe 100644 --- a/src/Base/Interpreter.cpp +++ b/src/Base/Interpreter.cpp @@ -106,7 +106,7 @@ void PyException::ThrowException() void PyException::raiseException() { PyGILStateLocker locker; - if (PP_PyDict_Object!=nullptr) { + if (PP_PyDict_Object) { // delete the Python dict upon destruction of edict Py::Dict edict(PP_PyDict_Object, true); PP_PyDict_Object = nullptr; diff --git a/src/Base/Parameter.cpp b/src/Base/Parameter.cpp index 3b19ce06dc..fe020d0385 100644 --- a/src/Base/Parameter.cpp +++ b/src/Base/Parameter.cpp @@ -700,7 +700,7 @@ std::string ParameterGrp::GetASCII(const char* Name, const char * pPreset) const DOMElement *pcElem = FindElement(_pGroupNode,"FCText",Name); // if not return preset if (!pcElem) { - if (pPreset==nullptr) + if (!pPreset) return std::string(""); else return std::string(pPreset); diff --git a/src/Base/PyObjectBase.cpp b/src/Base/PyObjectBase.cpp index 05811bdfcc..ca10b95232 100644 --- a/src/Base/PyObjectBase.cpp +++ b/src/Base/PyObjectBase.cpp @@ -353,7 +353,7 @@ int PyObjectBase::__setattro(PyObject *obj, PyObject *attro, PyObject *value) //Hint: In general we don't allow to delete attributes (i.e. value=0). However, if we want to allow //we must check then in _setattr() of all subclasses whether value is 0. - if ( value==nullptr ) { + if (!value) { PyErr_Format(PyExc_AttributeError, "Cannot delete attribute: '%s'", attr); return -1; }