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 | ec1115b344c88a6cb4de43af32de8557de076d2c (patch) | |
tree | 6d56bb02c2d430a819e1c6e970219888db6e80ae /gdb/tui | |
parent | 9dbd067f964d464b48c5899485786a37057f717e (diff) | |
download | gdb-ec1115b344c88a6cb4de43af32de8557de076d2c.zip gdb-ec1115b344c88a6cb4de43af32de8557de076d2c.tar.gz gdb-ec1115b344c88a6cb4de43af32de8557de076d2c.tar.bz2 |
[gdb/tui] Remove default entries in TUI translation tables
The TUI translation tables contain default entries at the end:
...
static struct tui_translate tui_border_kind_translate_hline[] = {
{ "space", ' ' },
{ "ascii", '-' },
{ "acs", -1 },
{ 0, 0 },
{ "ascii", '-' }
};
...
A simpler way of implementing this would be to to declare the first (or last)
entry the default, but in fact these default entries are not used.
Make this explicit by removing the default entries, and asserting in translate
that an entry will always be found.
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 | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c index 7d58a2d..fe80df4 100644 --- a/gdb/tui/tui-win.c +++ b/gdb/tui/tui-win.c @@ -116,8 +116,7 @@ struct tui_translate }; /* Translation table for border-mode variables. - The list of values must be terminated by a NULL. - After the NULL value, an entry defines the default. */ + The list of values must be terminated by a NULL. */ static struct tui_translate tui_border_mode_translate[] = { { "normal", A_NORMAL }, { "standout", A_STANDOUT }, @@ -126,8 +125,7 @@ static struct tui_translate tui_border_mode_translate[] = { { "half-standout", A_DIM | A_STANDOUT }, { "bold", A_BOLD }, { "bold-standout", A_BOLD | A_STANDOUT }, - { 0, 0 }, - { "normal", A_NORMAL } + { 0, 0 } }; /* Translation tables for border-kind, one for each border @@ -138,48 +136,42 @@ static struct tui_translate tui_border_kind_translate_vline[] = { { "space", ' ' }, { "ascii", '|' }, { "acs", -1 }, - { 0, 0 }, - { "ascii", '|' } + { 0, 0 } }; static struct tui_translate tui_border_kind_translate_hline[] = { { "space", ' ' }, { "ascii", '-' }, { "acs", -1 }, - { 0, 0 }, - { "ascii", '-' } + { 0, 0 } }; static struct tui_translate tui_border_kind_translate_ulcorner[] = { { "space", ' ' }, { "ascii", '+' }, { "acs", -1 }, - { 0, 0 }, - { "ascii", '+' } + { 0, 0 } }; static struct tui_translate tui_border_kind_translate_urcorner[] = { { "space", ' ' }, { "ascii", '+' }, { "acs", -1 }, - { 0, 0 }, - { "ascii", '+' } + { 0, 0 } }; static struct tui_translate tui_border_kind_translate_llcorner[] = { { "space", ' ' }, { "ascii", '+' }, { "acs", -1 }, - { 0, 0 }, - { "ascii", '+' } + { 0, 0 } }; static struct tui_translate tui_border_kind_translate_lrcorner[] = { { "space", ' ' }, { "ascii", '+' }, { "acs", -1 }, - { 0, 0 }, - { "ascii", '+' } + { 0, 0 } }; @@ -257,8 +249,7 @@ chtype tui_border_lrcorner; int tui_border_attrs; int tui_active_border_attrs; -/* Identify the item in the translation table. - When the item is not recognized, use the default entry. */ +/* Identify the item in the translation table. */ static struct tui_translate * translate (const char *name, struct tui_translate *table) { @@ -269,9 +260,7 @@ translate (const char *name, struct tui_translate *table) table++; } - /* Not found, return default entry. */ - table++; - return table; + gdb_assert_not_reached (""); } /* Update the tui internal configuration according to gdb settings. |