diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2021-05-27 13:59:00 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2021-05-27 14:00:07 -0400 |
commit | 9f26053690299e3a5d295d78c4ceeaf840344f0b (patch) | |
tree | 27cc770378c9ae45c0c723f2401b24af26079550 /gdb/python/py-auto-load.c | |
parent | af7f8f52dd6024951577cfc328c318fdd4089623 (diff) | |
download | binutils-9f26053690299e3a5d295d78c4ceeaf840344f0b.zip binutils-9f26053690299e3a5d295d78c4ceeaf840344f0b.tar.gz binutils-9f26053690299e3a5d295d78c4ceeaf840344f0b.tar.bz2 |
gdb: remove unnecessary lookup_cmd when deprecating commands
Remove a few instances where we look up a command by name, but could
just use the return value of a previous "add command" function call
instead.
gdb/ChangeLog:
* mi/mi-main.c (_initialize_mi_main):
* python/py-auto-load.c (gdbpy_initialize_auto_load):
* remote.c (_initialize_remote):
Change-Id: I6d06f9ca636e340c88c1064ae870483ad392607d
Diffstat (limited to 'gdb/python/py-auto-load.c')
-rw-r--r-- | gdb/python/py-auto-load.c | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/gdb/python/py-auto-load.c b/gdb/python/py-auto-load.c index 3b279312..2065985 100644 --- a/gdb/python/py-auto-load.c +++ b/gdb/python/py-auto-load.c @@ -59,9 +59,6 @@ info_auto_load_python_scripts (const char *pattern, int from_tty) int gdbpy_initialize_auto_load (void) { - struct cmd_list_element *cmd; - const char *cmd_name; - add_setshow_boolean_cmd ("python-scripts", class_support, &auto_load_python_scripts, _("\ Set the debugger's behaviour regarding auto-loaded Python scripts."), _("\ @@ -73,32 +70,28 @@ This options has security implications for untrusted inferiors."), auto_load_set_cmdlist_get (), auto_load_show_cmdlist_get ()); - add_setshow_boolean_cmd ("auto-load-scripts", class_support, - &auto_load_python_scripts, _("\ + set_show_commands auto_load_scripts_cmds + = add_setshow_boolean_cmd ("auto-load-scripts", class_support, + &auto_load_python_scripts, _("\ Set the debugger's behaviour regarding auto-loaded Python scripts, " "deprecated."), - _("\ + _("\ Show the debugger's behaviour regarding auto-loaded Python scripts, " "deprecated."), - NULL, NULL, show_auto_load_python_scripts, - &setlist, &showlist); - cmd_name = "auto-load-scripts"; - cmd = lookup_cmd (&cmd_name, setlist, "", NULL, -1, 1); - deprecate_cmd (cmd, "set auto-load python-scripts"); - - /* It is needed because lookup_cmd updates the CMD_NAME pointer. */ - cmd_name = "auto-load-scripts"; - cmd = lookup_cmd (&cmd_name, showlist, "", NULL, -1, 1); - deprecate_cmd (cmd, "show auto-load python-scripts"); + NULL, NULL, show_auto_load_python_scripts, + &setlist, &showlist); + deprecate_cmd (auto_load_scripts_cmds.set, "set auto-load python-scripts"); + deprecate_cmd (auto_load_scripts_cmds.show, "show auto-load python-scripts"); add_cmd ("python-scripts", class_info, info_auto_load_python_scripts, _("Print the list of automatically loaded Python scripts.\n\ Usage: info auto-load python-scripts [REGEXP]"), auto_load_info_cmdlist_get ()); - cmd = add_info ("auto-load-scripts", info_auto_load_python_scripts, _("\ + cmd_list_element *info_auto_load_scripts_cmd + = add_info ("auto-load-scripts", info_auto_load_python_scripts, _("\ Print the list of automatically loaded Python scripts, deprecated.")); - deprecate_cmd (cmd, "info auto-load python-scripts"); + deprecate_cmd (info_auto_load_scripts_cmd, "info auto-load python-scripts"); return 0; } |