aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui/tui-win.c
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2015-07-06 17:50:28 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2015-07-10 12:38:38 +0100
commit150375dc7ac877d1dc6e8aaf73a23479b720306c (patch)
tree641d518af89f336b840cdecf7cc35bd202021b86 /gdb/tui/tui-win.c
parent6dce28e413375aa878cf43853d32657d1fc26c6f (diff)
downloadgdb-150375dc7ac877d1dc6e8aaf73a23479b720306c.zip
gdb-150375dc7ac877d1dc6e8aaf73a23479b720306c.tar.gz
gdb-150375dc7ac877d1dc6e8aaf73a23479b720306c.tar.bz2
gdb/tui: Define tui window names once.
Don't duplicate the window names inside the completion function. Instead make use of the existing defines, and the tui_win_name function to obtain the window names. gdb/ChangeLog: * tui/tui-win.c (focus_completer): Don't duplicate the tui window names in this function.
Diffstat (limited to 'gdb/tui/tui-win.c')
-rw-r--r--gdb/tui/tui-win.c27
1 files changed, 5 insertions, 22 deletions
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index 215a7f5..947608a 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -374,26 +374,9 @@ focus_completer (struct cmd_list_element *ignore,
|| !tui_win_list[win_type]->generic.is_visible)
continue;
- switch (win_type)
- {
- case SRC_WIN:
- completion_name = "src";
- break;
- case DISASSEM_WIN:
- completion_name = "asm";
- break;
- case DATA_WIN:
- completion_name = "regs";
- break;
- case CMD_WIN:
- completion_name = "cmd";
- break;
- default:
- break;
- }
-
- if (completion_name != NULL)
- VEC_safe_push (const_char_ptr, completion_name_vec, completion_name);
+ completion_name = tui_win_name (&tui_win_list [win_type]->generic);
+ gdb_assert (completion_name != NULL);
+ VEC_safe_push (const_char_ptr, completion_name_vec, completion_name);
}
/* If no windows are considered visible then the TUI has not yet been
@@ -402,8 +385,8 @@ focus_completer (struct cmd_list_element *ignore,
default layout to SRC_COMMAND. */
if (VEC_length (const_char_ptr, completion_name_vec) == 0)
{
- VEC_safe_push (const_char_ptr, completion_name_vec, "src");
- VEC_safe_push (const_char_ptr, completion_name_vec, "cmd");
+ VEC_safe_push (const_char_ptr, completion_name_vec, SRC_NAME);
+ VEC_safe_push (const_char_ptr, completion_name_vec, CMD_NAME);
}
VEC_safe_push (const_char_ptr, completion_name_vec, "next");