From patchwork Thu Jul 4 17:02:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 33555 Received: (qmail 106737 invoked by alias); 4 Jul 2019 17:03:36 -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 105510 invoked by uid 89); 4 Jul 2019 17:03:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-17.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=48613, H*RU:esmtpa, H*r:esmtpa, HX-Spam-Relays-External:esmtpa X-HELO: gateway21.websitewelcome.com Received: from gateway21.websitewelcome.com (HELO gateway21.websitewelcome.com) (192.185.46.113) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 04 Jul 2019 17:03:22 +0000 Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway21.websitewelcome.com (Postfix) with ESMTP id E11F14011889E for ; Thu, 4 Jul 2019 12:03:20 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id j58ihuwS72PzOj58ih7dJN; Thu, 04 Jul 2019 12:03:20 -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=4Uom7r9TzNFtgMCkE49YRjsy5lHXZxY4sfqvZrpu+/A=; b=whcKwPZkkFEo3imfXaQ8qV5CD1 fznm4dvdg6vaYlF22kbIG4Q3MvtKbe1PQGiUI+puoNN+NlPJDzhl6sRnP6lBcVgKycpn6CptMC9nO 6yX/DX9LdGizIzTz+ohsOGaw/; Received: from 174-29-58-150.hlrn.qwest.net ([174.29.58.150]:34692 helo=bapiya.Home) by box5379.bluehost.com with esmtpa (Exim 4.92) (envelope-from ) id 1hj58i-002sDI-MY; Thu, 04 Jul 2019 12:03:20 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 19/61] Minor tui_reg_next / tui_reg_prev cleanup Date: Thu, 4 Jul 2019 11:02:29 -0600 Message-Id: <20190704170311.15982-20-tom@tromey.com> In-Reply-To: <20190704170311.15982-1-tom@tromey.com> References: <20190704170311.15982-1-tom@tromey.com> This changes tui_reg_next and tui_reg_prev so that they don't need to reference the TUI_DATA_WIN globals. 2019-07-04 Tom Tromey * tui/tui-regs.c (tui_reg_next, tui_reg_prev): Add "current_group" parameter. Don't reference globals. (tui_reg_command): Update. --- gdb/ChangeLog | 6 ++++++ gdb/tui/tui-regs.c | 21 +++++++++++---------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c index 931787ae4b5..31b252e2aa8 100644 --- a/gdb/tui/tui-regs.c +++ b/gdb/tui/tui-regs.c @@ -468,14 +468,13 @@ tui_display_register (struct tui_data_item_window *data) register window is not currently being displayed. */ static struct reggroup * -tui_reg_next (struct gdbarch *gdbarch) +tui_reg_next (struct reggroup *current_group, struct gdbarch *gdbarch) { struct reggroup *group = NULL; - if (TUI_DATA_WIN != NULL) + if (current_group != NULL) { - group = TUI_DATA_WIN->current_group; - group = reggroup_next (gdbarch, group); + group = reggroup_next (gdbarch, current_group); if (group == NULL) group = reggroup_next (gdbarch, NULL); } @@ -487,14 +486,13 @@ tui_reg_next (struct gdbarch *gdbarch) register window is not currently being displayed. */ static struct reggroup * -tui_reg_prev (struct gdbarch *gdbarch) +tui_reg_prev (struct reggroup *current_group, struct gdbarch *gdbarch) { struct reggroup *group = NULL; - if (TUI_DATA_WIN != NULL) + if (current_group != NULL) { - group = TUI_DATA_WIN->current_group; - group = reggroup_prev (gdbarch, group); + group = reggroup_prev (gdbarch, current_group); if (group == NULL) group = reggroup_prev (gdbarch, NULL); } @@ -524,10 +522,13 @@ tui_reg_command (const char *args, int from_tty) if (TUI_DATA_WIN == NULL || !TUI_DATA_WIN->is_visible) tui_set_layout_by_name (DATA_NAME); + struct reggroup *current_group = NULL; + if (TUI_DATA_WIN != NULL) + current_group = TUI_DATA_WIN->current_group; if (strncmp (args, "next", len) == 0) - match = tui_reg_next (gdbarch); + match = tui_reg_next (current_group, gdbarch); else if (strncmp (args, "prev", len) == 0) - match = tui_reg_prev (gdbarch); + match = tui_reg_prev (current_group, gdbarch); /* This loop matches on the initial part of a register group name. If this initial part in ARGS matches only one register