summaryrefslogtreecommitdiff
path: root/gdb/python/py-breakpoint.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2016-11-06 21:25:22 -0700
committerTom Tromey <tom@tromey.com>2017-01-10 19:13:33 -0700
commitbf2a52fa2ac2c4486653993a765fd922b3cd64a6 (patch)
tree2c78ab76c1e1759e5e3b415ee04b26d7122b8784 /gdb/python/py-breakpoint.c
parentf59fe7f8e3e55472e6fcfb06677ff4925dad1f64 (diff)
downloadbinutils-gdb-bf2a52fa2ac2c4486653993a765fd922b3cd64a6.tar.gz
Use gdbpy_ref in gdbpy_breakpoints
This changes gdbpy_breakpoints to use gdbpy_ref. 2017-01-10 Tom Tromey <tom@tromey.com> * python/py-breakpoint.c (gdbpy_breakpoints): Use gdbpy_ref.
Diffstat (limited to 'gdb/python/py-breakpoint.c')
-rw-r--r--gdb/python/py-breakpoint.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c
index c8847ffe08a..eedb697786c 100644
--- a/gdb/python/py-breakpoint.c
+++ b/gdb/python/py-breakpoint.c
@@ -762,28 +762,20 @@ build_bp_list (struct breakpoint *b, void *arg)
PyObject *
gdbpy_breakpoints (PyObject *self, PyObject *args)
{
- PyObject *list, *tuple;
-
if (bppy_live == 0)
return PyTuple_New (0);
- list = PyList_New (0);
- if (!list)
+ gdbpy_ref list (PyList_New (0));
+ if (list == NULL)
return NULL;
/* If iterate_over_breakpoints returns non NULL it signals an error
condition. In that case abandon building the list and return
NULL. */
- if (iterate_over_breakpoints (build_bp_list, list) != NULL)
- {
- Py_DECREF (list);
- return NULL;
- }
-
- tuple = PyList_AsTuple (list);
- Py_DECREF (list);
+ if (iterate_over_breakpoints (build_bp_list, list.get ()) != NULL)
+ return NULL;
- return tuple;
+ return PyList_AsTuple (list.get ());
}
/* Call the "stop" method (if implemented) in the breakpoint