Mercurial > pytave
comparison oct-py-object.h @ 403:3644df6564bc
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.
author | Mike Miller <mtmiller@octave.org> |
---|---|
date | Fri, 28 Apr 2017 14:19:49 -0700 |
parents | 3a64a336d214 |
children |
comparison
equal
deleted
inserted
replaced
402:c4b78e449c62 | 403:3644df6564bc |
---|---|
29 { | 29 { |
30 | 30 |
31 class python_object | 31 class python_object |
32 { | 32 { |
33 public: | 33 public: |
34 python_object (PyObject *obj = 0) | 34 python_object (PyObject *obj = nullptr) |
35 { | 35 { |
36 pyobj = obj; | 36 pyobj = obj; |
37 isowned = pyobj != 0; | 37 isowned = pyobj != nullptr; |
38 } | 38 } |
39 | 39 |
40 python_object (const python_object& oth) | 40 python_object (const python_object& oth) |
41 { | 41 { |
42 pyobj = oth.pyobj; | 42 pyobj = oth.pyobj; |
67 operator = (PyObject *obj) | 67 operator = (PyObject *obj) |
68 { | 68 { |
69 if (isowned) | 69 if (isowned) |
70 Py_DECREF (pyobj); | 70 Py_DECREF (pyobj); |
71 pyobj = obj; | 71 pyobj = obj; |
72 isowned = pyobj != 0; | 72 isowned = pyobj != nullptr; |
73 if (isowned) | 73 if (isowned) |
74 Py_INCREF (pyobj); | 74 Py_INCREF (pyobj); |
75 return *this; | 75 return *this; |
76 } | 76 } |
77 | 77 |
94 PyObject * | 94 PyObject * |
95 release () | 95 release () |
96 { | 96 { |
97 isowned = false; | 97 isowned = false; |
98 PyObject *ret = pyobj; | 98 PyObject *ret = pyobj; |
99 pyobj = 0; | 99 pyobj = nullptr; |
100 return ret; | 100 return ret; |
101 } | 101 } |
102 | 102 |
103 private: | 103 private: |
104 PyObject *pyobj; | 104 PyObject *pyobj; |