[2/3,gdb/tui] Fix buglet in set_border_kind_item
Commit Message
While factoring out set_border_kind_item I noticed a buglet:
...
struct tui_translate *entry = translate (key, dict);
if (*lval != (chtype) entry->value)
{
*lval = (entry->value < 0) ? acs : entry->value;
...
When assigning the new value to *lval, an entry->value of -1 is taken into
account, but not when comparing to the current value of *lval.
Fix this by introducing:
...
int val = (entry->value < 0) ? acs : entry->value;
...
and using this in both comparison and assignment.
Tested on x86_64-linux.
---
gdb/tui/tui-win.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
@@ -300,10 +300,11 @@ set_border_kind_item (chtype *lval, const char *key,
struct tui_translate *dict, int acs, bool *lval_changed)
{
struct tui_translate *entry = translate (key, dict);
+ int val = (entry->value < 0) ? acs : entry->value;
- if (*lval != (chtype) entry->value)
+ if (*lval != (chtype) val)
{
- *lval = (entry->value < 0) ? acs : entry->value;
+ *lval = val;
*lval_changed = true;
}
}