diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2021-12-01 11:41:31 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2021-12-03 16:48:23 -0500 |
commit | c471bdb19858ad0e7a0d5f5017fd5e1892525da8 (patch) | |
tree | 4573ba65482f0a7af9542860167a4f97f0b79a71 /gdb/cli/cli-decode.h | |
parent | 46680d22de34be5057a1033eb489c1453e70eecc (diff) | |
download | fsf-binutils-gdb-c471bdb19858ad0e7a0d5f5017fd5e1892525da8.zip fsf-binutils-gdb-c471bdb19858ad0e7a0d5f5017fd5e1892525da8.tar.gz fsf-binutils-gdb-c471bdb19858ad0e7a0d5f5017fd5e1892525da8.tar.bz2 |
gdb: use intrusive_list for cmd_list_element aliases list
Change the manually-implemented linked list to use intrusive_list. This
is not strictly necessary, but it makes the code much simpler.
Change-Id: Idd08090ebf2db8bdcf68e85ef72a9635f1584ccc
Diffstat (limited to 'gdb/cli/cli-decode.h')
-rw-r--r-- | gdb/cli/cli-decode.h | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h index f7945ba..1d3a3db 100644 --- a/gdb/cli/cli-decode.h +++ b/gdb/cli/cli-decode.h @@ -26,6 +26,7 @@ #include "gdb_regex.h" #include "cli-script.h" #include "completer.h" +#include "gdbsupport/intrusive_list.h" /* Not a set/show command. Note that some commands which begin with "set" or "show" might be in this category, if their syntax does @@ -246,11 +247,18 @@ struct cmd_list_element aliased command can be located in case it has been hooked. */ struct cmd_list_element *alias_target = nullptr; - /* Start of a linked list of all aliases of this command. */ - struct cmd_list_element *aliases = nullptr; - - /* Link pointer for aliases on an alias list. */ - struct cmd_list_element *alias_chain = nullptr; + /* Node to link aliases on an alias list. */ + using aliases_list_node_type + = intrusive_list_node<cmd_list_element>; + aliases_list_node_type aliases_list_node; + + /* Linked list of all aliases of this command. */ + using aliases_list_member_node_type + = intrusive_member_node<cmd_list_element, + &cmd_list_element::aliases_list_node>; + using aliases_list_type + = intrusive_list<cmd_list_element, aliases_list_member_node_type>; + aliases_list_type aliases; /* If non-null, the pointer to a field in 'struct cli_suppress_notification', which will be set to true in cmd_func |