GNU Binutils with patches for OS216
Revision | ea68593bd2c649a73754e150340ba3400c007682 (tree) |
---|---|
Time | 2020-07-02 12:21:12 |
Author | Tom Tromey <tom@trom...> |
Commiter | Tom Tromey |
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.
@@ -1,3 +1,7 @@ | ||
1 | +2020-07-01 Tom Tromey <tom@tromey.com> | |
2 | + | |
3 | + * tui/tui-regs.c (tui_reggroup_completer): Use complete_on_enum. | |
4 | + | |
1 | 5 | 2020-07-01 Fangrui Song <maskray@google.com> |
2 | 6 | |
3 | 7 | * dwarf2/read.c (lnp_state_machine::check_line_address): Test -1. |
@@ -631,18 +631,11 @@ tui_reggroup_completer (struct cmd_list_element *ignore, | ||
631 | 631 | completion_tracker &tracker, |
632 | 632 | const char *text, const char *word) |
633 | 633 | { |
634 | - static const char *extra[] = { "next", "prev", NULL }; | |
635 | - size_t len = strlen (word); | |
636 | - const char **tmp; | |
634 | + static const char * const extra[] = { "next", "prev", NULL }; | |
637 | 635 | |
638 | 636 | reggroup_completer (ignore, tracker, text, word); |
639 | 637 | |
640 | - /* XXXX use complete_on_enum instead? */ | |
641 | - for (tmp = extra; *tmp != NULL; ++tmp) | |
642 | - { | |
643 | - if (strncmp (word, *tmp, len) == 0) | |
644 | - tracker.add_completion (make_unique_xstrdup (*tmp)); | |
645 | - } | |
638 | + complete_on_enum (tracker, extra, text, word); | |
646 | 639 | } |
647 | 640 | |
648 | 641 | void _initialize_tui_regs (); |