From patchwork Thu Jul 4 17:02:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 33576 Received: (qmail 110471 invoked by alias); 4 Jul 2019 17:04:01 -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 107120 invoked by uid 89); 4 Jul 2019 17:03:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=H*RU:esmtpa, H*r:esmtpa X-HELO: gateway22.websitewelcome.com Received: from gateway22.websitewelcome.com (HELO gateway22.websitewelcome.com) (192.185.46.194) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 04 Jul 2019 17:03:32 +0000 Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway22.websitewelcome.com (Postfix) with ESMTP id D735526098 for ; Thu, 4 Jul 2019 12:03:30 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id j58shuwbT2PzOj58sh7dSe; Thu, 04 Jul 2019 12:03:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=2oy1QygSnMNyM+sBMwSAtiEU9vuZ4ZaxQgodbf80HvA=; b=HPY9eWHtWsNvh+MJGdDwkCIuwv 8yynU+6015Id5NAADIYdxX6W2SCLsQcAUM/DiUTy3o6hJumR5VwuNslpWkzJ8Ud9/rlYq1mnPv+Me Cf7dq6/RKTSo0h4ZcXtKAewk3; Received: from 174-29-58-150.hlrn.qwest.net ([174.29.58.150]:34702 helo=bapiya.Home) by box5379.bluehost.com with esmtpa (Exim 4.92) (envelope-from ) id 1hj58s-002sKm-KR; Thu, 04 Jul 2019 12:03:30 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 45/61] Simplify show_source_or_disasm_and_command Date: Thu, 4 Jul 2019 11:02:55 -0600 Message-Id: <20190704170311.15982-46-tom@tromey.com> In-Reply-To: <20190704170311.15982-1-tom@tromey.com> References: <20190704170311.15982-1-tom@tromey.com> This changes show_source_or_disasm_and_command to unify the creation and re-initialization cases. 2019-07-04 Tom Tromey * tui/tui-layout.c (show_source_or_disasm_and_command): Unify creation and re-initialization cases. --- gdb/ChangeLog | 5 +++++ gdb/tui/tui-layout.c | 49 ++++++++++++++++++-------------------------- 2 files changed, 25 insertions(+), 29 deletions(-) diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c index 4e914b79ea0..83eb0dfeb46 100644 --- a/gdb/tui/tui-layout.c +++ b/gdb/tui/tui-layout.c @@ -693,7 +693,7 @@ show_source_or_disasm_and_command (enum tui_layout_type layout_type) { if (tui_current_layout () != layout_type) { - struct tui_win_info **win_info_ptr; + struct tui_source_window_base *win_info; int src_height, cmd_height; struct tui_locator_window *locator = tui_locator_win_info_ptr (); gdb_assert (locator != nullptr); @@ -705,42 +705,33 @@ show_source_or_disasm_and_command (enum tui_layout_type layout_type) src_height = tui_term_height () - cmd_height; if (layout_type == SRC_COMMAND) - win_info_ptr = &tui_win_list[SRC_WIN]; - else - win_info_ptr = &tui_win_list[DISASSEM_WIN]; - - tui_source_window_base *base; - if ((*win_info_ptr) == NULL) { - if (layout_type == SRC_COMMAND) - *win_info_ptr = make_source_window (src_height - 1, 0); - else - *win_info_ptr = make_disasm_window (src_height - 1, 0); - locator->reset (2 /* 1 */ , - tui_term_width (), - 0, - src_height - 1); - base = (tui_source_window_base *) *win_info_ptr; + if (tui_win_list[SRC_WIN] == nullptr) + tui_win_list[SRC_WIN] = new tui_source_window (); + win_info = TUI_SRC_WIN; } else { - base = (tui_source_window_base *) *win_info_ptr; - locator->reset (2 /* 1 */ , - tui_term_width (), - 0, - src_height - 1); - base->m_has_locator = true; - (*win_info_ptr)->reset (src_height - 1, - tui_term_width (), - 0, - 0); - tui_make_visible (*win_info_ptr); + if (tui_win_list[DISASSEM_WIN] == nullptr) + tui_win_list[DISASSEM_WIN] = new tui_disasm_window (); + win_info = TUI_DISASM_WIN; } - base->m_has_locator = true; + locator->reset (2 /* 1 */ , + tui_term_width (), + 0, + src_height - 1); + win_info->reset (src_height - 1, + tui_term_width (), + 0, + 0); + tui_make_visible (win_info); + + + win_info->m_has_locator = true; tui_make_visible (locator); tui_show_locator_content (); - tui_show_source_content (base); + tui_show_source_content (win_info); if (TUI_CMD_WIN == NULL) {