From patchwork Wed Jul 8 20:37:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 7593 Received: (qmail 61737 invoked by alias); 8 Jul 2015 20:37:51 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 60200 invoked by uid 89); 8 Jul 2015 20:37:46 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: mail-wi0-f172.google.com Received: from mail-wi0-f172.google.com (HELO mail-wi0-f172.google.com) (209.85.212.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 08 Jul 2015 20:37:46 +0000 Received: by wiwl6 with SMTP id l6so355807403wiw.0 for ; Wed, 08 Jul 2015 13:37:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=sTlizxY/hSj0ZF7JbpeUDqUiz7QWryU7Cmi3zzqLIa4=; b=Qzm4Hok2r1oag+kRJnfdIaR2qGIVvcmPOdJVNUGJXhUFGquyS7zOzSD8/hIN2lU7qA VF4EcXXY8Sxso7sVXSr+xpf68bVmgrPEBoaXBN4LgnQ6vX5n/Cl4UboH/H+vyqVbc+Za YH6ruOtQFbb1utibt8/fyXgXtHioYuXQKgvdaXF8IoplP/lwLmb3QRWbIGymYMxDcCEL dpvunU+bseNBlt3jfiKIOI/4BDQ8hYPQpMsErXwu7bx1K8rc8bG8B6q9g6lAdYWv0He5 rVer8dDa3Y5XcGwlmMO8FykgwbCduuWDMJBrgrExWHBoXNzDeAoi2QNHwIAElYzmuG25 Mnhg== X-Gm-Message-State: ALoCoQni8+0e4+is3QP5EfTQwGeixpkCkcBQni/dTFOO++mhGah8nSH7H1PpJ8wdkbH7B81R1GMi X-Received: by 10.194.109.97 with SMTP id hr1mr22725824wjb.95.1436387863066; Wed, 08 Jul 2015 13:37:43 -0700 (PDT) Received: from localhost (host81-158-4-174.range81-158.btcentralplus.com. [81.158.4.174]) by smtp.gmail.com with ESMTPSA id wx9sm5228472wjb.6.2015.07.08.13.37.41 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Jul 2015 13:37:42 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH 2/3] gdb/tui: Define tui window names once. Date: Wed, 8 Jul 2015 21:37:29 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-IsSubscribed: yes 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 + * tui/tui-win.c (focus_completer): Don't duplicate the tui window + names in this function. + +2015-07-06 Andrew Burgess + * 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");