From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 109327 invoked by alias); 4 Jul 2019 17:03:53 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 106773 invoked by uid 89); 4 Jul 2019 17:03:37 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.9 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:29 +0000 Received: from cm12.websitewelcome.com (cm12.websitewelcome.com [100.42.49.8]) by gateway22.websitewelcome.com (Postfix) with ESMTP id BA72C25311 for ; Thu, 4 Jul 2019 12:03:27 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id j58phkjgRiQerj58phEYjh; Thu, 04 Jul 2019 12:03:27 -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=HZKMv5uj7g7SbmpMkzfcMfFqQJYM53LnbKZkzuU0q6Q=; b=vDeEkhGhlvBOE4XtPBvb6d+mwI 2yUyR7FdaCkmtsfsvAtLWKaib6SHuiIXXiQaSxRPkxnqLN6YW+z3wJKs/sHyFF4Fii0Fi73lOs2Z0 uB6TdqCfX7FsIucWWXUNlATbM; Received: from 174-29-58-150.hlrn.qwest.net ([174.29.58.150]:34696 helo=bapiya.Home) by box5379.bluehost.com with esmtpa (Exim 4.92) (envelope-from ) id 1hj58p-002sIW-Fa; Thu, 04 Jul 2019 12:03:27 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 37/61] Introduce reset_locator function in tui-layout.c Date: Thu, 04 Jul 2019 17:03:00 -0000 Message-Id: <20190704170311.15982-38-tom@tromey.com> In-Reply-To: <20190704170311.15982-1-tom@tromey.com> References: <20190704170311.15982-1-tom@tromey.com> X-SW-Source: 2019-07/txt/msg00128.txt.bz2 init_and_make_win in tui-layout.c is now only called for the locator -- earlier changes have made most of the cases here obsolete. This patch removes init_and_make_win and introduces a reset_locator function. Window creation is now much simpler to follow, because it is no longer quite so dynamic. (Though it will become even simpler in coming patches.) 2019-07-04 Tom Tromey * tui/tui-layout.c (show_source_disasm_command): Use reset_locator. (reset_locator): New function. (init_and_make_win): Remove. (show_source_or_disasm_and_command): Use reset_locator. --- gdb/ChangeLog | 8 ++++ gdb/tui/tui-layout.c | 89 ++++++++++++-------------------------------- 2 files changed, 31 insertions(+), 66 deletions(-) diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c index 23537b7f496..ab849a9813d 100644 --- a/gdb/tui/tui-layout.c +++ b/gdb/tui/tui-layout.c @@ -43,10 +43,8 @@ ** Static Local Decls ********************************/ static void show_layout (enum tui_layout_type); -static tui_gen_win_info *init_and_make_win (tui_gen_win_info *, - enum tui_win_type, - int, int, int, int, - enum tui_box); +static void reset_locator (tui_gen_win_info *, + int, int, int, int); static void show_source_or_disasm_and_command (enum tui_layout_type); static struct tui_win_info *make_command_window (int, int); static struct tui_win_info *make_source_window (int, int); @@ -614,13 +612,11 @@ show_source_disasm_command (void) { tui_win_list[DISASSEM_WIN] = make_disasm_window (asm_height, src_height - 1); - init_and_make_win (locator, - LOCATOR_WIN, - 2 /* 1 */ , - tui_term_width (), - 0, - (src_height + asm_height) - 1, - DONT_BOX_WINDOW); + reset_locator (locator, + 2 /* 1 */ , + tui_term_width (), + 0, + (src_height + asm_height) - 1); } else { @@ -696,13 +692,11 @@ show_data (enum tui_layout_type new_layout) else tui_win_list[win_type] = make_disasm_window (src_height, data_height - 1); - init_and_make_win (locator, - LOCATOR_WIN, - 2 /* 1 */ , - tui_term_width (), - 0, - total_height - 1, - DONT_BOX_WINDOW); + reset_locator (locator, + 2 /* 1 */ , + tui_term_width (), + 0, + total_height - 1); base = (tui_source_window_base *) tui_win_list[win_type]; } else @@ -751,48 +745,13 @@ tui_gen_win_info::reset (enum tui_win_type win_type, origin.y = origin_y_; } -/* init_and_make_win(). - */ -static tui_gen_win_info * -init_and_make_win (tui_gen_win_info *win_info, - enum tui_win_type win_type, - int height, int width, - int origin_x, int origin_y, - enum tui_box box_it) +static void +reset_locator (tui_gen_win_info *win_info, + int height, int width, + int origin_x, int origin_y) { - if (win_info == NULL) - { - switch (win_type) - { - case SRC_WIN: - win_info = new tui_source_window (); - break; - - case DISASSEM_WIN: - win_info = new tui_disasm_window (); - break; - - case DATA_WIN: - win_info = new tui_data_window (); - break; - - case CMD_WIN: - win_info = new tui_cmd_window (); - break; - - case EXEC_INFO_WIN: - win_info = new tui_exec_info_window (); - break; - - default: - gdb_assert_not_reached (_("unhandled window type")); - } - } - - win_info->reset (win_type, height, width, origin_x, origin_y); - tui_make_window (win_info, box_it); - - return win_info; + win_info->reset (LOCATOR_WIN, height, width, origin_x, origin_y); + tui_make_window (win_info, DONT_BOX_WINDOW); } @@ -825,13 +784,11 @@ show_source_or_disasm_and_command (enum tui_layout_type layout_type) *win_info_ptr = make_source_window (src_height - 1, 0); else *win_info_ptr = make_disasm_window (src_height - 1, 0); - init_and_make_win (locator, - LOCATOR_WIN, - 2 /* 1 */ , - tui_term_width (), - 0, - src_height - 1, - DONT_BOX_WINDOW); + reset_locator (locator, + 2 /* 1 */ , + tui_term_width (), + 0, + src_height - 1); base = (tui_source_window_base *) *win_info_ptr; } else -- 2.17.2