public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <andrew.burgess@embecosm.com>
To: gdb-patches@sourceware.org
Cc: Andrew Burgess <andrew.burgess@embecosm.com>
Subject: [PATCH 2/3] gdb/tui: Define tui window names once.
Date: Wed, 08 Jul 2015 20:37:00 -0000	[thread overview]
Message-ID: <c6be4c52e2923f113b0599fac1f60dea18603ce5.1436387456.git.andrew.burgess@embecosm.com> (raw)
In-Reply-To: <cover.1436387456.git.andrew.burgess@embecosm.com>
In-Reply-To: <cover.1436387456.git.andrew.burgess@embecosm.com>

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.
---
 gdb/ChangeLog     |  5 +++++
 gdb/tui/tui-win.c | 27 +++++----------------------
 2 files changed, 10 insertions(+), 22 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2e889e9..646bc5b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
 2015-07-06  Andrew Burgess  <andrew.burgess@embecosm.com>
 
+	* tui/tui-win.c (focus_completer): Don't duplicate the tui window
+	names in this function.
+
+2015-07-06  Andrew Burgess  <andrew.burgess@embecosm.com>
+
 	* tui/tui-data.h (SRC_NAME): Convert to lower case.
 	(CMD_NAME): Likewise.
 	(DATA_NAME): Likewise.
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");
-- 
2.4.0

  reply	other threads:[~2015-07-08 20:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-08 20:37 [PATCH 0/3] convert tui window names to lower case Andrew Burgess
2015-07-08 20:37 ` Andrew Burgess [this message]
2015-07-08 20:37 ` [PATCH 1/3] gdb: Convert TUI windows " Andrew Burgess
2015-07-08 20:37 ` [PATCH 3/3] gdb/tui: Use cleanups to free string copies Andrew Burgess
2015-07-08 20:52 ` [PATCH 0/3] convert tui window names to lower case Patrick Palka
2015-07-09 10:44   ` Pedro Alves
2015-07-09 12:53   ` Patrick Palka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c6be4c52e2923f113b0599fac1f60dea18603ce5.1436387456.git.andrew.burgess@embecosm.com \
    --to=andrew.burgess@embecosm.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).