From patchwork Tue Sep 10 19:08:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 34476 Received: (qmail 25477 invoked by alias); 10 Sep 2019 19:09:07 -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 25364 invoked by uid 89); 10 Sep 2019 19:09:06 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.2 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= X-HELO: gateway23.websitewelcome.com Received: from gateway23.websitewelcome.com (HELO gateway23.websitewelcome.com) (192.185.50.104) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 10 Sep 2019 19:09:05 +0000 Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway23.websitewelcome.com (Postfix) with ESMTP id 81BD27D92 for ; Tue, 10 Sep 2019 14:09:02 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id 7lVeiZd3y2PzO7lVeiTlBc; Tue, 10 Sep 2019 14:09:02 -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=QjbJ25AvYBQm4lnCe56GqsTTD5bDPpYrriGuUbSHc7c=; b=r1AQgG8izbMIQ9DbK6hPOvxXza BfTpFncC7HTcC1pFOecqzX+hsQLDTxkmh71LnG5G0DK4viEvjj9HQTnH4DIDaU00PXq3YcK4ZVuPN Pomvb5Kz3110umOBv1jTRDM5I; Received: from 71-218-73-27.hlrn.qwest.net ([71.218.73.27]:51786 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1i7lVd-000EYF-W9; Tue, 10 Sep 2019 14:09:02 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 07/20] Simplify tui_source_window_base::show_source_content Date: Tue, 10 Sep 2019 13:08:44 -0600 Message-Id: <20190910190857.6562-8-tom@tromey.com> In-Reply-To: <20190910190857.6562-1-tom@tromey.com> References: <20190910190857.6562-1-tom@tromey.com> tui_source_window_base::show_source_content is not used outside the class any more, so this makes it private. Examining the callers shows that it can't be called without source contents, so it can be simplified as well. gdb/ChangeLog 2019-09-10 Tom Tromey * tui/tui-winsource.h (struct tui_source_window_base) : Now private. * tui/tui-winsource.c (tui_source_window_base::show_source_content): Don't handle empty content case. --- gdb/ChangeLog | 8 ++++++++ gdb/tui/tui-winsource.c | 11 +++-------- gdb/tui/tui-winsource.h | 5 +++-- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c index 8b507ed9126..683856de817 100644 --- a/gdb/tui/tui-winsource.c +++ b/gdb/tui/tui-winsource.c @@ -238,15 +238,10 @@ tui_show_source_line (struct tui_source_window_base *win_info, int lineno) void tui_source_window_base::show_source_content () { - if (!content.empty ()) - { - int lineno; + gdb_assert (!content.empty ()); - for (lineno = 1; lineno <= content.size (); lineno++) - tui_show_source_line (this, lineno); - } - else - erase_source_content (); + for (int lineno = 1; lineno <= content.size (); lineno++) + tui_show_source_line (this, lineno); check_and_display_highlight_if_needed (); refresh_window (); diff --git a/gdb/tui/tui-winsource.h b/gdb/tui/tui-winsource.h index eca0bde4bb8..a66c63597e7 100644 --- a/gdb/tui/tui-winsource.h +++ b/gdb/tui/tui-winsource.h @@ -76,6 +76,9 @@ struct tui_source_element struct tui_source_window_base : public tui_win_info { +private: + void show_source_content (); + protected: explicit tui_source_window_base (enum tui_win_type type); @@ -106,8 +109,6 @@ public: virtual bool location_matches_p (struct bp_location *loc, int line_no) = 0; - void show_source_content (); - void update_exec_info (); /* Update the window to display the given location. Does nothing if