From patchwork Sun Jun 23 22:43:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 33323 Received: (qmail 59106 invoked by alias); 23 Jun 2019 23:26:08 -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 59042 invoked by uid 89); 23 Jun 2019 23:26:08 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.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= X-HELO: gateway30.websitewelcome.com Received: from gateway30.websitewelcome.com (HELO gateway30.websitewelcome.com) (192.185.144.21) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 23 Jun 2019 23:26:06 +0000 Received: from cm12.websitewelcome.com (cm12.websitewelcome.com [100.42.49.8]) by gateway30.websitewelcome.com (Postfix) with ESMTP id 407F02A03F for ; Sun, 23 Jun 2019 18:26:05 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id fBs5h9X4BiQerfBs5hfNHp; Sun, 23 Jun 2019 18:26:05 -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=C+x9j2Bcvzl2QIXlhihJY2djaQSgsGumx8+M7FCSFr0=; b=P+xVNvyLiuNx2/vqSCIewcc21e 7Ir8jV0vZ+6yijeDxv54DUkKqkMnCr83HfhC3Djzu+voLitZXkWalUod6S4aNRqANj5/O9enmxtGN PO4UwpyNSOa1Nl21Df9lRBhTL; Received: from 75-166-12-78.hlrn.qwest.net ([75.166.12.78]:54396 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1hfBDA-000vDQ-8l; Sun, 23 Jun 2019 17:43:48 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 37/66] Remove NULL check from tui_set_exec_info_content Date: Sun, 23 Jun 2019 16:43:00 -0600 Message-Id: <20190623224329.16060-38-tom@tromey.com> In-Reply-To: <20190623224329.16060-1-tom@tromey.com> References: <20190623224329.16060-1-tom@tromey.com> tui_set_exec_info_content ensures that the window's "execution_info" is allocated, so the NULL check here is redundant and can be removed. 2019-06-23 Tom Tromey * tui/tui-winsource.c (tui_set_exec_info_content): Remove NULL check. --- gdb/ChangeLog | 5 +++ gdb/tui/tui-winsource.c | 70 +++++++++++++++++++---------------------- 2 files changed, 37 insertions(+), 38 deletions(-) diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c index 209d33d6c99..5e60e9e3726 100644 --- a/gdb/tui/tui-winsource.c +++ b/gdb/tui/tui-winsource.c @@ -495,46 +495,40 @@ tui_set_exec_info_content (struct tui_win_info *win_info) if (exec_info_ptr->content == NULL) exec_info_ptr->content = tui_alloc_content (win_info->height, exec_info_ptr->type); - if (exec_info_ptr->content != NULL) - { - int i; - tui_update_breakpoint_info (win_info, 1); - for (i = 0; i < win_info->content_size; i++) - { - struct tui_win_element *element; - struct tui_win_element *src_element; - int mode; - - element = exec_info_ptr->content[i]; - src_element = win_info->content[i]; - - memset(element->which_element.simple_string, ' ', - sizeof(element->which_element.simple_string)); - element->which_element.simple_string[TUI_EXECINFO_SIZE - 1] = 0; - - /* Now update the exec info content based upon the state - of each line as indicated by the source content. */ - mode = src_element->which_element.source.has_break; - if (mode & TUI_BP_HIT) - element->which_element.simple_string[TUI_BP_HIT_POS] = - (mode & TUI_BP_HARDWARE) ? 'H' : 'B'; - else if (mode & (TUI_BP_ENABLED | TUI_BP_DISABLED)) - element->which_element.simple_string[TUI_BP_HIT_POS] = - (mode & TUI_BP_HARDWARE) ? 'h' : 'b'; - - if (mode & TUI_BP_ENABLED) - element->which_element.simple_string[TUI_BP_BREAK_POS] = '+'; - else if (mode & TUI_BP_DISABLED) - element->which_element.simple_string[TUI_BP_BREAK_POS] = '-'; - - if (src_element->which_element.source.is_exec_point) - element->which_element.simple_string[TUI_EXEC_POS] = '>'; - } - exec_info_ptr->content_size = win_info->content_size; + tui_update_breakpoint_info (win_info, 1); + for (int i = 0; i < win_info->content_size; i++) + { + struct tui_win_element *element; + struct tui_win_element *src_element; + int mode; + + element = exec_info_ptr->content[i]; + src_element = win_info->content[i]; + + memset(element->which_element.simple_string, ' ', + sizeof(element->which_element.simple_string)); + element->which_element.simple_string[TUI_EXECINFO_SIZE - 1] = 0; + + /* Now update the exec info content based upon the state + of each line as indicated by the source content. */ + mode = src_element->which_element.source.has_break; + if (mode & TUI_BP_HIT) + element->which_element.simple_string[TUI_BP_HIT_POS] = + (mode & TUI_BP_HARDWARE) ? 'H' : 'B'; + else if (mode & (TUI_BP_ENABLED | TUI_BP_DISABLED)) + element->which_element.simple_string[TUI_BP_HIT_POS] = + (mode & TUI_BP_HARDWARE) ? 'h' : 'b'; + + if (mode & TUI_BP_ENABLED) + element->which_element.simple_string[TUI_BP_BREAK_POS] = '+'; + else if (mode & TUI_BP_DISABLED) + element->which_element.simple_string[TUI_BP_BREAK_POS] = '-'; + + if (src_element->which_element.source.is_exec_point) + element->which_element.simple_string[TUI_EXEC_POS] = '>'; } - else - ret = TUI_FAILURE; + exec_info_ptr->content_size = win_info->content_size; } return ret;