From 2cae4e60fa1b7d92b80ff16aeba99f5d9436dbfa Mon Sep 17 00:00:00 2001
From: Sebastião Guerra <sebastiao.luiz.guerra@gmail.com>
Date: Sat, 3 Oct 2026 17:48:47 -0300
Subject: Replace NULL pointer constants with nullptr
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Sebastião Guerra <sebastiao.luiz.guerra@gmail.com>
---
 src/pythonize.cpp | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/pythonize.cpp b/src/pythonize.cpp
index 2a27b63..ce01f01 100644
--- a/src/pythonize.cpp
+++ b/src/pythonize.cpp
@@ -36,7 +36,7 @@ ObjectRef::ObjectRef (ObjectRef *oi, PyObject *o)
 Pythonize::Pythonize ()
 {
     pythonInit  = 1;
-    objects    = NULL;
+    objects    = nullptr;
 
     if (debug) printf ("\n\nPythonize constructor -- pid = %i\n", getpid ());
 
@@ -65,10 +65,10 @@ bool Pythonize::runScript (char *scriptPath)
 
     if (debug) printf ("Running script: %s\n", scriptPath);
 
-    if (scriptPath == NULL || strlen (scriptPath) == 0) return false;
+    if (!scriptPath || strlen (scriptPath) == 0) return false;
 
     f = fopen (scriptPath, "r");
-    if (f == NULL) return false;
+    if (!f) return false;
 
     res = PyRun_SimpleFile (f, scriptPath);
 
@@ -81,7 +81,7 @@ PyObject * Pythonize::runFunction (PyObject *object, PyObject *args)
 {
 
     if (!PyCallable_Check (object))
-        return NULL;
+        return nullptr;
 
     PyObject *res = PyObject_CallObject (object, args ? args : PyTuple_New (0));
     Py_XINCREF (res);
@@ -93,7 +93,7 @@ void * Pythonize::runFunctionVoid (PyObject *object, PyObject *args)
 {
 
     if (!PyCallable_Check (object))
-        return NULL;
+        return nullptr;
 
     PyObject *pyRes = PyObject_CallObject (object, args ? args : PyTuple_New (0));
     void *res = PyLong_AsVoidPtr (pyRes);
@@ -104,7 +104,7 @@ void * Pythonize::runFunctionVoid (PyObject *object, PyObject *args)
 bool Pythonize::runString (char *str)
 {
 
-    if (str == NULL || strlen (str) == 0) return false;
+    if (!str || strlen (str) == 0) return false;
 
     int res = PyRun_SimpleString (str);
 
@@ -113,7 +113,7 @@ bool Pythonize::runString (char *str)
 
 bool Pythonize::appendToSysPath (const char* newPath)
 {
-    if (newPath == NULL || strlen (newPath) == 0) return false;
+    if (!newPath || strlen (newPath) == 0) return false;
 
     const char *fmtString = "import sys\nif not '%s' in sys.path:\n\tsys.path.append ('%s')\n"; //print sys.path\n";
     int length      = strlen (fmtString) + 2*strlen (newPath) + 1;
@@ -129,12 +129,12 @@ bool Pythonize::appendToSysPath (const char* newPath)
 
 PyObject *Pythonize::importModule (char *moduleName)
 {
-    if (moduleName == NULL || strlen (moduleName) == 0) return NULL;
+    if (!moduleName || strlen (moduleName) == 0) return nullptr;
 
     PyObject *module = PyImport_ImportModule (moduleName);
 
     objects = new ObjectRef (objects, module);
-    if (!objects) return NULL;
+    if (!objects) return nullptr;
 
     return module;
 }
@@ -174,7 +174,7 @@ Pythonize *initialize ()
     if (!_pythonize || !_pythonize->getPythonInit ())
     {
         if (_pythonize) delete _pythonize;
-        return NULL;
+        return nullptr;
     }
 
     return _pythonize;
@@ -198,14 +198,14 @@ bool appendToSysPath (const char* newPath)
                 // or gets a PyObject for an already loaded module
 PyObject *importModule (char *moduleName)
 {
-    return _pythonize ? _pythonize->importModule (moduleName) : NULL;
+    return _pythonize ? _pythonize->importModule (moduleName) : nullptr;
 }
 
                 // returns an object from a loaded module
                 // you must decref the object returned when done with it (new reference returned)
 PyObject *getNewObjectRef (PyObject *module, const char *object)
 {
-    return _pythonize ? _pythonize->getNewObjectRef (module, object) : NULL;
+    return _pythonize ? _pythonize->getNewObjectRef (module, object) : nullptr;
 }
 
 bool getPythonInit ()
@@ -234,6 +234,6 @@ bool runString (char *str)
                 // runs a callable Python object
 PyObject *runFunction (PyObject *object, PyObject *args)
 {
-    return _pythonize ? _pythonize->runFunction (object, args) : NULL;
+    return _pythonize ? _pythonize->runFunction (object, args) : nullptr;
 }
 }
-- 
cgit v1.2.3

