# HG changeset patch # User Mike Miller # Date 1493414389 25200 # Node ID 3644df6564bc10aa4208f86ffd3bd3e8211a50ed # Parent c4b78e449c626f41ad8e7ebf0035e697c7dbc871 maint: use C++11 nullptr rather than 0 or NULL * __py_struct_from_dict__.cc, oct-py-eval.cc, oct-py-eval.h, oct-py-object.h, oct-py-types.cc, oct-py-util.cc, pycall.cc, pyeval.cc, pyexec.cc: Use C++11 nullptr rather than 0 or NULL. diff -r c4b78e449c62 -r 3644df6564bc __py_struct_from_dict__.cc --- a/__py_struct_from_dict__.cc Fri Apr 28 14:07:57 2017 -0700 +++ b/__py_struct_from_dict__.cc Fri Apr 28 14:19:49 2017 -0700 @@ -323,7 +323,7 @@ boost::python::numeric::array::set_module_and_type ("numpy", "ndarray"); _import_array (); // FIXME: PyObject *obj = convert argument to Python (args(0)); - PyObject *obj = 0; + PyObject *obj = nullptr; try { boost::python::object arg; @@ -368,7 +368,7 @@ if (PyBytes_Check (obj) || PyUnicode_Check (obj)) str = pytave::extract_py_str (obj); - else if (Py_TYPE (obj)->tp_str != NULL) + else if (Py_TYPE (obj)->tp_str != nullptr) { PyObject *s = PyObject_Str (obj); str = pytave::extract_py_str (s); diff -r c4b78e449c62 -r 3644df6564bc oct-py-eval.cc --- a/oct-py-eval.cc Fri Apr 28 14:07:57 2017 -0700 +++ b/oct-py-eval.cc Fri Apr 28 14:19:49 2017 -0700 @@ -57,7 +57,7 @@ PyObject * py_call_function (PyObject *callable, const octave_value_list& args) { - PyObject *kwargs = 0; + PyObject *kwargs = nullptr; PyObject *args_list = PyList_New (0); if (! args_list) octave_throw_bad_alloc (); diff -r c4b78e449c62 -r 3644df6564bc oct-py-eval.h --- a/oct-py-eval.h Fri Apr 28 14:07:57 2017 -0700 +++ b/oct-py-eval.h Fri Apr 28 14:19:49 2017 -0700 @@ -56,7 +56,7 @@ //! @return return value of @a func PyObject * py_call_function (const std::string& func, PyObject *args, - PyObject *kwargs = 0); + PyObject *kwargs = nullptr); //! Call a Python function with the given argument list. //! @@ -76,15 +76,16 @@ //! @param kwargs dictionary of keyword arguments //! @return return value of @a func PyObject * - py_call_function (PyObject *callable, PyObject *args, PyObject *kwargs = 0); + py_call_function (PyObject *callable, PyObject *args, + PyObject *kwargs = nullptr); PyObject * - py_eval_string (const std::string& expr, PyObject *globals = 0, - PyObject *locals = 0); + py_eval_string (const std::string& expr, PyObject *globals = nullptr, + PyObject *locals = nullptr); PyObject * - py_exec_string (const std::string& expr, PyObject *globals = 0, - PyObject *locals = 0); + py_exec_string (const std::string& expr, PyObject *globals = nullptr, + PyObject *locals = nullptr); } diff -r c4b78e449c62 -r 3644df6564bc oct-py-object.h --- a/oct-py-object.h Fri Apr 28 14:07:57 2017 -0700 +++ b/oct-py-object.h Fri Apr 28 14:19:49 2017 -0700 @@ -31,10 +31,10 @@ class python_object { public: - python_object (PyObject *obj = 0) + python_object (PyObject *obj = nullptr) { pyobj = obj; - isowned = pyobj != 0; + isowned = pyobj != nullptr; } python_object (const python_object& oth) @@ -69,7 +69,7 @@ if (isowned) Py_DECREF (pyobj); pyobj = obj; - isowned = pyobj != 0; + isowned = pyobj != nullptr; if (isowned) Py_INCREF (pyobj); return *this; @@ -96,7 +96,7 @@ { isowned = false; PyObject *ret = pyobj; - pyobj = 0; + pyobj = nullptr; return ret; } diff -r c4b78e449c62 -r 3644df6564bc oct-py-types.cc --- a/oct-py-types.cc Fri Apr 28 14:07:57 2017 -0700 +++ b/oct-py-types.cc Fri Apr 28 14:19:49 2017 -0700 @@ -344,8 +344,8 @@ octave_scalar_map map; Py_ssize_t pos = 0; - PyObject *py_key = 0; - PyObject *py_value = 0; + PyObject *py_key = nullptr; + PyObject *py_value = nullptr; while (PyDict_Next (obj, &pos, &py_key, &py_value)) { diff -r c4b78e449c62 -r 3644df6564bc oct-py-util.cc --- a/oct-py-util.cc Fri Apr 28 14:07:57 2017 -0700 +++ b/oct-py-util.cc Fri Apr 28 14:19:49 2017 -0700 @@ -151,7 +151,7 @@ } // FIXME: could make this into a class/singleton wrapper a la Octave core - PyObject *objstore = 0; + PyObject *objstore = nullptr; inline PyObject * py_objstore () diff -r c4b78e449c62 -r 3644df6564bc pycall.cc --- a/pycall.cc Fri Apr 28 14:07:57 2017 -0700 +++ b/pycall.cc Fri Apr 28 14:19:49 2017 -0700 @@ -100,7 +100,7 @@ try { - PyObject *callable = 0; + PyObject *callable = nullptr; if (args(0).is_string ()) { callable = pytave::py_find_function (args(0).string_value ()); diff -r c4b78e449c62 -r 3644df6564bc pyeval.cc --- a/pyeval.cc Fri Apr 28 14:07:57 2017 -0700 +++ b/pyeval.cc Fri Apr 28 14:19:49 2017 -0700 @@ -79,7 +79,7 @@ Py_Initialize (); - PyObject *local_namespace = 0; + PyObject *local_namespace = nullptr; if (nargin > 1) { local_namespace = pytave::pyobject_unwrap_object (args(1)); diff -r c4b78e449c62 -r 3644df6564bc pyexec.cc --- a/pyexec.cc Fri Apr 28 14:07:57 2017 -0700 +++ b/pyexec.cc Fri Apr 28 14:19:49 2017 -0700 @@ -73,7 +73,7 @@ Py_Initialize (); - PyObject *local_namespace = 0; + PyObject *local_namespace = nullptr; if (nargin > 1) { local_namespace = pytave::pyobject_unwrap_object (args(1));