From 88f6c39cb7343ccd76ed50e59431203f34765cb2 Mon Sep 17 00:00:00 2001 From: Sebastian Eibl <sebastian.eibl@fau.de> Date: Tue, 9 Jun 2020 08:32:10 +0000 Subject: [PATCH] [CLANG-TIDY] modernize-use-nullptr --- src/blockforest/python/Exports.cpp | 2 +- src/python_coupling/Manager.cpp | 2 +- src/python_coupling/Shell.cpp | 2 +- src/python_coupling/basic_exports/BasicExports.cpp | 12 ++++++------ 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/blockforest/python/Exports.cpp b/src/blockforest/python/Exports.cpp index 17f1b2534..83ef6f662 100644 --- a/src/blockforest/python/Exports.cpp +++ b/src/blockforest/python/Exports.cpp @@ -126,7 +126,7 @@ object python_createUniformBlockGrid(tuple args, dict kw) shared_ptr<Config> cfg = python_coupling::configFromPythonDict( kw ); try { - shared_ptr< StructuredBlockForest > blocks = createUniformBlockGridFromConfig( cfg->getGlobalBlock(), NULL, keepGlobalBlockInformation ); + shared_ptr< StructuredBlockForest > blocks = createUniformBlockGridFromConfig( cfg->getGlobalBlock(), nullptr, keepGlobalBlockInformation ); return object(blocks); } catch( std::exception & e) diff --git a/src/python_coupling/Manager.cpp b/src/python_coupling/Manager.cpp index 9ccf4a597..82bf23cf2 100644 --- a/src/python_coupling/Manager.cpp +++ b/src/python_coupling/Manager.cpp @@ -114,7 +114,7 @@ void Manager::triggerInitialization() } catch ( boost::python::error_already_set & ) { - PyObject *type_ptr = NULL, *value_ptr = NULL, *traceback_ptr = NULL; + PyObject *type_ptr = nullptr, *value_ptr = nullptr, *traceback_ptr = nullptr; PyErr_Fetch(&type_ptr, &value_ptr, &traceback_ptr); if( type_ptr ) diff --git a/src/python_coupling/Shell.cpp b/src/python_coupling/Shell.cpp index 85cb22812..183e329d3 100644 --- a/src/python_coupling/Shell.cpp +++ b/src/python_coupling/Shell.cpp @@ -116,7 +116,7 @@ namespace python_coupling { else line = PyOS_Readline( stdin, stdout, (char*)prompt2_.c_str() ); - if ( line == NULL || *line == '\0' ) { // interrupt or EOF + if ( line == nullptr || *line == '\0' ) { // interrupt or EOF result.clear(); return false; } diff --git a/src/python_coupling/basic_exports/BasicExports.cpp b/src/python_coupling/basic_exports/BasicExports.cpp index d43a339f9..17341f26b 100644 --- a/src/python_coupling/basic_exports/BasicExports.cpp +++ b/src/python_coupling/basic_exports/BasicExports.cpp @@ -67,7 +67,7 @@ struct NumpyIntConversion auto typeName = std::string( Py_TYPE(pyObj)->tp_name ); if ( typeName.substr(0,9) == "numpy.int" ) return pyObj; - return 0; + return nullptr; } static void construct( PyObject* pyObj, converter::rvalue_from_python_stage1_data* data ) @@ -94,7 +94,7 @@ struct NumpyFloatConversion auto typeName = std::string( Py_TYPE(pyObj)->tp_name ); if ( typeName.substr(0,11) == "numpy.float" ) return pyObj; - return 0; + return nullptr; } static void construct(PyObject* pyObj, converter::rvalue_from_python_stage1_data* data) @@ -208,7 +208,7 @@ struct PythonTuple_to_Vector3 using namespace boost::python; if ( ! ( PySequence_Check(obj) && PySequence_Size( obj ) == 3 )) - return NULL; + return nullptr; object element0 ( handle<>( borrowed( PySequence_GetItem(obj,0) ))); object element1 ( handle<>( borrowed( PySequence_GetItem(obj,1) ))); @@ -219,7 +219,7 @@ struct PythonTuple_to_Vector3 extract<T>( element2 ).check() ) return obj; else - return NULL; + return nullptr; } static void construct( PyObject* obj, boost::python::converter::rvalue_from_python_stage1_data* data ) @@ -302,7 +302,7 @@ struct PythonTuple_to_Cell using namespace boost::python; if ( ! ( PySequence_Check(obj) && PySequence_Size( obj ) == 3 )) - return NULL; + return nullptr; object element0 ( handle<>( borrowed( PySequence_GetItem(obj,0) ))); object element1 ( handle<>( borrowed( PySequence_GetItem(obj,1) ))); @@ -313,7 +313,7 @@ struct PythonTuple_to_Cell extract<cell_idx_t>( element2 ).check() ) return obj; else - return NULL; + return nullptr; } static void construct( PyObject* obj, boost::python::converter::rvalue_from_python_stage1_data* data ) -- GitLab