gdb: remove use of iterate_over_inferiors in py-inferior.c
Use range-based for instead of iterate_over_inferiors in one spot in the Python code. gdb/ChangeLog: * python/py-inferior.c (build_inferior_list): Remove. (gdbpy_ref): Use range-based for loop to iterate over inferiors.
This commit is contained in:
parent
bd267fd1f9
commit
d9bc85b65b
2 changed files with 15 additions and 14 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2020-01-17 Simon Marchi <simon.marchi@efficios.com>
|
||||||
|
|
||||||
|
* python/py-inferior.c (build_inferior_list): Remove.
|
||||||
|
(gdbpy_ref): Use range-based for loop to iterate over inferiors.
|
||||||
|
|
||||||
2020-01-16 Christian Biesinger <cbiesinger@google.com>
|
2020-01-16 Christian Biesinger <cbiesinger@google.com>
|
||||||
|
|
||||||
* btrace.c (btrace_compute_ftrace_1): Fix spelling error (Unkown).
|
* btrace.c (btrace_compute_ftrace_1): Fix spelling error (Unkown).
|
||||||
|
|
|
@ -462,18 +462,6 @@ infpy_get_progspace (PyObject *self, void *closure)
|
||||||
return pspace_to_pspace_object (pspace).release ();
|
return pspace_to_pspace_object (pspace).release ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
build_inferior_list (struct inferior *inf, void *arg)
|
|
||||||
{
|
|
||||||
PyObject *list = (PyObject *) arg;
|
|
||||||
gdbpy_ref<inferior_object> inferior = inferior_to_inferior_object (inf);
|
|
||||||
|
|
||||||
if (inferior == NULL)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return PyList_Append (list, (PyObject *) inferior.get ()) ? 1 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Implementation of gdb.inferiors () -> (gdb.Inferior, ...).
|
/* Implementation of gdb.inferiors () -> (gdb.Inferior, ...).
|
||||||
Returns a tuple of all inferiors. */
|
Returns a tuple of all inferiors. */
|
||||||
PyObject *
|
PyObject *
|
||||||
|
@ -483,8 +471,16 @@ gdbpy_inferiors (PyObject *unused, PyObject *unused2)
|
||||||
if (list == NULL)
|
if (list == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (iterate_over_inferiors (build_inferior_list, list.get ()))
|
for (inferior *inf : all_inferiors ())
|
||||||
return NULL;
|
{
|
||||||
|
gdbpy_ref<inferior_object> inferior = inferior_to_inferior_object (inf);
|
||||||
|
|
||||||
|
if (inferior == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (PyList_Append (list.get (), (PyObject *) inferior.get ()) != 0)
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return PyList_AsTuple (list.get ());
|
return PyList_AsTuple (list.get ());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue