public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Use complete_on_enum in tui_reggroup_completer
@ 2020-07-02 3:24 Tom Tromey
0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2020-07-02 3:24 UTC (permalink / raw)
To: gdb-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ea68593bd2c649a73754e150340ba3400c007682
commit ea68593bd2c649a73754e150340ba3400c007682
Author: Tom Tromey <tom@tromey.com>
Date: Wed Jul 1 21:21:12 2020 -0600
Use complete_on_enum in tui_reggroup_completer
tui_reggroup_completer has an "XXXX" comment suggesting the use of
complete_on_enum. This patch implements this suggestion.
gdb/ChangeLog
2020-07-01 Tom Tromey <tom@tromey.com>
* tui/tui-regs.c (tui_reggroup_completer): Use complete_on_enum.
Diff:
---
gdb/ChangeLog | 4 ++++
gdb/tui/tui-regs.c | 11 ++---------
2 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 007798135e5..6a6260d49e2 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2020-07-01 Tom Tromey <tom@tromey.com>
+
+ * tui/tui-regs.c (tui_reggroup_completer): Use complete_on_enum.
+
2020-07-01 Fangrui Song <maskray@google.com>
* dwarf2/read.c (lnp_state_machine::check_line_address): Test -1.
diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
index d33f0aadef8..b99e29972de 100644
--- a/gdb/tui/tui-regs.c
+++ b/gdb/tui/tui-regs.c
@@ -631,18 +631,11 @@ tui_reggroup_completer (struct cmd_list_element *ignore,
completion_tracker &tracker,
const char *text, const char *word)
{
- static const char *extra[] = { "next", "prev", NULL };
- size_t len = strlen (word);
- const char **tmp;
+ static const char * const extra[] = { "next", "prev", NULL };
reggroup_completer (ignore, tracker, text, word);
- /* XXXX use complete_on_enum instead? */
- for (tmp = extra; *tmp != NULL; ++tmp)
- {
- if (strncmp (word, *tmp, len) == 0)
- tracker.add_completion (make_unique_xstrdup (*tmp));
- }
+ complete_on_enum (tracker, extra, text, word);
}
void _initialize_tui_regs ();
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-07-02 3:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-02 3:24 [binutils-gdb] Use complete_on_enum in tui_reggroup_completer Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).