No behavior changes expected.
Change-Id: Ice8958068fd4025e23bff87bcdee45a5f64a41c4
---
gdb/interps.c | 12 +-----------
gdb/ui.c | 10 ++++++++++
gdb/ui.h | 4 ++++
3 files changed, 15 insertions(+), 11 deletions(-)
@@ -83,16 +83,6 @@ interp_factory_register (const char *name, interp_factory_func func)
interpreter_factories.emplace_back (name, func);
}
-/* Add interpreter INTERP to the gdb interpreter list. The
- interpreter must not have previously been added. */
-static void
-interp_add (struct ui *ui, struct interp *interp)
-{
- gdb_assert (ui->lookup_existing_interp (interp->name ()) == nullptr);
-
- ui->interp_list.push_back (*interp);
-}
-
/* This sets the current interpreter to be INTERP. If INTERP has not
been initialized, then this will also run the init method.
@@ -170,7 +160,7 @@ interp_lookup (struct ui *ui, const char *name)
if (strcmp (factory.name, name) == 0)
{
interp = factory.func (factory.name);
- interp_add (ui, interp);
+ ui->add_interp (interp);
return interp;
}
@@ -159,6 +159,16 @@ ui::lookup_existing_interp (const char *name) const
return nullptr;
}
+/* See ui.h. */
+
+void
+ui::add_interp (interp *interp)
+{
+ gdb_assert (this->lookup_existing_interp (interp->name ()) == nullptr);
+
+ this->interp_list.push_back (*interp);
+}
+
/* See top.h. */
void
@@ -162,6 +162,10 @@ struct ui : public intrusive_list_node<ui>
/* Look up the interpreter for NAME. If no such interpreter exists,
return nullptr, otherwise return a pointer to the interpreter. */
interp *lookup_existing_interp (const char *name) const;
+
+ /* Add interpreter INTERP to this UI's interpreter list. The
+ interpreter must not have previously been added. */
+ void add_interp (interp *interp);
};
/* The main UI. This is the UI that is bound to stdin/stdout/stderr.