diff options
author | Tom de Vries <tdevries@suse.de> | 2023-07-12 12:07:40 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2023-07-12 12:07:40 +0200 |
commit | 664ac93fa86a974aaf42497a58bc1c05dde09909 (patch) | |
tree | 2a1b88ed56a0d881cd5550df4ec2549227631621 /gdb/tui | |
parent | 275cef134913f0b96240876576502273ae0bdb6d (diff) | |
download | gdb-664ac93fa86a974aaf42497a58bc1c05dde09909.zip gdb-664ac93fa86a974aaf42497a58bc1c05dde09909.tar.gz gdb-664ac93fa86a974aaf42497a58bc1c05dde09909.tar.bz2 |
[gdb/tui] Make translate return entry->value instead of entry
The only use of "entry = translate (...)" is entry->value.
Simplify using the function by returning entry->value instead.
Tested on x86_64-linux.
Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/tui')
-rw-r--r-- | gdb/tui/tui-win.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c index 2cc8177..93cf45e 100644 --- a/gdb/tui/tui-win.c +++ b/gdb/tui/tui-win.c @@ -223,14 +223,14 @@ chtype tui_border_lrcorner; int tui_border_attrs; int tui_active_border_attrs; -/* Identify the item in the translation table. */ -static struct tui_translate * +/* Identify the item in the translation table, and return the corresponding value. */ +static int translate (const char *name, struct tui_translate *table) { while (table->name) { if (name && strcmp (table->name, name) == 0) - return table; + return table->value; table++; } @@ -247,7 +247,7 @@ translate_acs (const char *name, struct tui_translate *table, int acs_char) if (strcmp (name, "acs") == 0) return acs_char; - return translate (name, table)->value; + return translate (name, table); } /* Update the tui internal configuration according to gdb settings. @@ -257,20 +257,18 @@ bool tui_update_variables () { bool need_redraw = false; - struct tui_translate *entry; + int val; - entry = translate (tui_border_mode, tui_border_mode_translate); - need_redraw - |= assign_return_if_changed<int> (tui_border_attrs, entry->value); + val = translate (tui_border_mode, tui_border_mode_translate); + need_redraw |= assign_return_if_changed<int> (tui_border_attrs, val); - entry = translate (tui_active_border_mode, tui_border_mode_translate); - need_redraw - |= assign_return_if_changed<int> (tui_active_border_attrs, entry->value); + val = translate (tui_active_border_mode, tui_border_mode_translate); + need_redraw |= assign_return_if_changed<int> (tui_active_border_attrs, val); /* If one corner changes, all characters are changed. Only check the first one. */ - int val = translate_acs (tui_border_kind, tui_border_kind_translate_corner, - ACS_LRCORNER); + val = translate_acs (tui_border_kind, tui_border_kind_translate_corner, + ACS_LRCORNER); need_redraw |= assign_return_if_changed<chtype> (tui_border_lrcorner, val); tui_border_llcorner |