DISABLE_COPY_AND_ASSIGN (ui_interp_info);
/* Each top level has its own independent set of interpreters. */
- interp *interp_list = nullptr;
+ intrusive_list<interp> interp_list;
interp *current_interpreter = nullptr;
interp *top_level_interpreter = nullptr;
gdb_assert (interp_lookup_existing (ui, interp->name ()) == NULL);
- interp->next = ui_interp.interp_list;
- ui_interp.interp_list = interp;
+ ui_interp.interp_list.push_back (*interp);
}
/* This sets the current interpreter to be INTERP. If INTERP has not
interp_lookup_existing (struct ui *ui, const char *name)
{
ui_interp_info &ui_interp = get_interp_info (ui);
- struct interp *interp;
- for (interp = ui_interp.interp_list;
- interp != NULL;
- interp = interp->next)
- {
- if (strcmp (interp->name (), name) == 0)
- return interp;
- }
+ for (interp &interp : ui_interp.interp_list)
+ if (strcmp (interp.name (), name) == 0)
+ return &interp;
- return NULL;
+ return nullptr;
}
/* See interps.h. */
#ifndef INTERPS_H
#define INTERPS_H
+#include "gdbsupport/intrusive_list.h"
+
struct ui_out;
struct interp;
struct ui;
extern void interp_exec (struct interp *interp, const char *command);
-class interp
+class interp : public intrusive_list_node<interp>
{
public:
explicit interp (const char *name);
const char *m_name;
public:
- /* Interpreters are stored in a linked list, this is the next
- one... */
- interp *next = nullptr;
-
/* Has the init method been run? */
bool inited = false;
};