aboutsummaryrefslogtreecommitdiff
path: root/gdb/python
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2020-12-11 09:33:36 -0700
committerTom Tromey <tom@tromey.com>2020-12-11 09:33:40 -0700
commit24fd95b4cd40f0108299c02f31f2d2a129f83769 (patch)
tree6ec333c8b503bf0d1977889bcebba980dd1b24c9 /gdb/python
parent7446266408f6c8cdf890c23c391c0c803c7077ca (diff)
downloadgdb-24fd95b4cd40f0108299c02f31f2d2a129f83769.zip
gdb-24fd95b4cd40f0108299c02f31f2d2a129f83769.tar.gz
gdb-24fd95b4cd40f0108299c02f31f2d2a129f83769.tar.bz2
Change varobj_dynamic::child_iter to unique_ptr
This changes varobj_dynamic::child_iter to be a unique_ptr, removing some manual management. gdb/ChangeLog 2020-12-11 Tom Tromey <tom@tromey.com> * varobj.c (struct varobj_dynamic) <child_iter>: Now unique_ptr. (varobj_get_iterator): Return unique_ptr. (update_dynamic_varobj_children, install_visualizer) (varobj::~varobj): Update. * python/python-internal.h (py_varobj_get_iterator): Return unique_ptr. * python/py-varobj.c (py_varobj_get_iterator): Return unique_ptr.
Diffstat (limited to 'gdb/python')
-rw-r--r--gdb/python/py-varobj.c5
-rw-r--r--gdb/python/python-internal.h4
2 files changed, 5 insertions, 4 deletions
diff --git a/gdb/python/py-varobj.c b/gdb/python/py-varobj.c
index c3fb2e9..dfc9e2b 100644
--- a/gdb/python/py-varobj.c
+++ b/gdb/python/py-varobj.c
@@ -133,7 +133,7 @@ py_varobj_iter::py_varobj_iter (struct varobj *var, gdbpy_ref<> &&pyiter)
/* Return a new pretty-printed varobj iterator suitable to iterate
over VAR's children. */
-struct varobj_iter *
+std::unique_ptr<varobj_iter>
py_varobj_get_iterator (struct varobj *var, PyObject *printer)
{
gdbpy_enter_varobj enter_py (var);
@@ -156,5 +156,6 @@ py_varobj_get_iterator (struct varobj *var, PyObject *printer)
error (_("Could not get children iterator"));
}
- return new py_varobj_iter (var, std::move (iter));
+ return std::unique_ptr<varobj_iter> (new py_varobj_iter (var,
+ std::move (iter)));
}
diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
index 3fdfede..f7e1edc 100644
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -754,8 +754,8 @@ int gdb_pymodule_addobject (PyObject *module, const char *name,
struct varobj_iter;
struct varobj;
-struct varobj_iter *py_varobj_get_iterator (struct varobj *var,
- PyObject *printer);
+std::unique_ptr<varobj_iter> py_varobj_get_iterator (struct varobj *var,
+ PyObject *printer);
/* Deleter for Py_buffer unique_ptr specialization. */