aboutsummaryrefslogtreecommitdiff
path: root/gdb/interps.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2023-04-28 14:27:12 -0400
committerSimon Marchi <simon.marchi@efficios.com>2023-05-01 15:40:54 -0400
commit4a91f820ef4d1301ea1a85c8de313a39457b266e (patch)
treeaa912ef587a6ce46cdf47da1580be37e38e33088 /gdb/interps.c
parent13d03262f25bfbf15e4a5f1d867cca243c7ee3ca (diff)
downloadgdb-4a91f820ef4d1301ea1a85c8de313a39457b266e.zip
gdb-4a91f820ef4d1301ea1a85c8de313a39457b266e.tar.gz
gdb-4a91f820ef4d1301ea1a85c8de313a39457b266e.tar.bz2
gdb: store interps in an intrusive_list
Use intrusive_list, instead of hand-made linked list. Change-Id: Idc857b40dfa3e3c35671045898331cca2c928097
Diffstat (limited to 'gdb/interps.c')
-rw-r--r--gdb/interps.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/gdb/interps.c b/gdb/interps.c
index a066c4a..54e1cb4 100644
--- a/gdb/interps.c
+++ b/gdb/interps.c
@@ -49,7 +49,7 @@ struct ui_interp_info
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;
@@ -132,8 +132,7 @@ interp_add (struct ui *ui, struct interp *interp)
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
@@ -204,17 +203,12 @@ static struct interp *
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. */