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.
This commit is contained in:
Tom Tromey 2016-11-06 21:25:22 -07:00
parent f59fe7f8e3
commit bf2a52fa2a
2 changed files with 9 additions and 13 deletions

View file

@ -1,3 +1,7 @@
2017-01-10 Tom Tromey <tom@tromey.com>
* python/py-breakpoint.c (gdbpy_breakpoints): Use gdbpy_ref.
2017-01-10 Tom Tromey <tom@tromey.com> 2017-01-10 Tom Tromey <tom@tromey.com>
* python/py-inferior.c (gdbpy_inferiors): Use gdbpy_ref. * python/py-inferior.c (gdbpy_inferiors): Use gdbpy_ref.

View file

@ -762,28 +762,20 @@ build_bp_list (struct breakpoint *b, void *arg)
PyObject * PyObject *
gdbpy_breakpoints (PyObject *self, PyObject *args) gdbpy_breakpoints (PyObject *self, PyObject *args)
{ {
PyObject *list, *tuple;
if (bppy_live == 0) if (bppy_live == 0)
return PyTuple_New (0); return PyTuple_New (0);
list = PyList_New (0); gdbpy_ref list (PyList_New (0));
if (!list) if (list == NULL)
return NULL; return NULL;
/* If iterate_over_breakpoints returns non NULL it signals an error /* If iterate_over_breakpoints returns non NULL it signals an error
condition. In that case abandon building the list and return condition. In that case abandon building the list and return
NULL. */ NULL. */
if (iterate_over_breakpoints (build_bp_list, list) != NULL) if (iterate_over_breakpoints (build_bp_list, list.get ()) != NULL)
{ return NULL;
Py_DECREF (list);
return NULL;
}
tuple = PyList_AsTuple (list); return PyList_AsTuple (list.get ());
Py_DECREF (list);
return tuple;
} }
/* Call the "stop" method (if implemented) in the breakpoint /* Call the "stop" method (if implemented) in the breakpoint