diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2021-06-25 21:35:40 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2021-06-25 21:35:40 -0400 |
commit | 0f8e2034128e4a73e02cb8311eeeea7e886a5985 (patch) | |
tree | 609b9baf7a5f167daa28b0341743aa650677f28a /gdb/cli/cli-decode.c | |
parent | ac2d77c6a102ca785aae565aec93a3478a9f4544 (diff) | |
download | gdb-0f8e2034128e4a73e02cb8311eeeea7e886a5985.zip gdb-0f8e2034128e4a73e02cb8311eeeea7e886a5985.tar.gz gdb-0f8e2034128e4a73e02cb8311eeeea7e886a5985.tar.bz2 |
gdb: add context getter/setter to cmd_list_element
Straightforward replacement of get_cmd_context / set_cmd_context with
cmd_list_element methods.
gdb/ChangeLog:
* cli/cli-decode.h (struct cmd_list_element) <set_context,
context>: New.
<context>: Rename to...
<m_context>: ... this.
* cli/cli-decode.c (set_cmd_context, get_cmd_context): Remove.
* command.h (set_cmd_context, get_cmd_context): Remove, use
cmd_list_element::set_context and cmd_list_element::context
everywhere instead.
Change-Id: I5016b0079014e3f17d1aa449ada7954473bf2b5d
Diffstat (limited to 'gdb/cli/cli-decode.c')
-rw-r--r-- | gdb/cli/cli-decode.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index 009986c..f2fdeb0 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -135,18 +135,6 @@ cmd_cfunc_eq (struct cmd_list_element *cmd, cmd_const_cfunc_ftype *cfunc) } void -set_cmd_context (struct cmd_list_element *cmd, void *context) -{ - cmd->context = context; -} - -void * -get_cmd_context (struct cmd_list_element *cmd) -{ - return cmd->context; -} - -void set_cmd_completer (struct cmd_list_element *cmd, completer_ftype *completer) { cmd->completer = completer; /* Ok. */ @@ -593,8 +581,8 @@ add_setshow_enum_cmd (const char *name, set_list, show_list); commands.set->enums = enumlist; - set_cmd_context (commands.set, context); - set_cmd_context (commands.show, context); + commands.set->set_context (context); + commands.show->set_context (context); return commands; } @@ -920,7 +908,8 @@ delete_cmd (const char *name, struct cmd_list_element **list, if (strcmp (iter->name, name) == 0) { if (iter->destroyer) - iter->destroyer (iter, iter->context); + iter->destroyer (iter, iter->context ()); + if (iter->hookee_pre) iter->hookee_pre->hook_pre = 0; *prehook = iter->hook_pre; |