From patchwork Tue Sep 10 19:08:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 34488 Received: (qmail 27110 invoked by alias); 10 Sep 2019 19:09:17 -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 26106 invoked by uid 89); 10 Sep 2019 19:09:11 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.7 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*r:esmtpa, H*RU:esmtpa, HX-Spam-Relays-External:esmtpa X-HELO: gateway30.websitewelcome.com Received: from gateway30.websitewelcome.com (HELO gateway30.websitewelcome.com) (192.185.197.25) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 10 Sep 2019 19:09:09 +0000 Received: from cm11.websitewelcome.com (cm11.websitewelcome.com [100.42.49.5]) by gateway30.websitewelcome.com (Postfix) with ESMTP id 028AC7822 for ; Tue, 10 Sep 2019 14:09:08 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id 7lVji5wdMdnCe7lVjiR9EZ; Tue, 10 Sep 2019 14:09:07 -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=AFFUueOiaXf0rSm3oVnFl9q5x9D4JZG0fjYyMdJ73OA=; b=BtzOL8ghIOrNgSWwQY1ri6csvW AQZG6F4frlvn944UFy1WtT8ciNi66fiKBfXrL9mACEtgoansLhbBDRC5A9kQZU+8sjFdgwDRghU9D HS4RDvRmXOLCbxu/EydiO0Qp7; Received: from 71-218-73-27.hlrn.qwest.net ([71.218.73.27]:51788 helo=bapiya.Home) by box5379.bluehost.com with esmtpa (Exim 4.92) (envelope-from ) id 1i7lVj-000EcZ-AE; Tue, 10 Sep 2019 14:09:07 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 19/20] Use make_unique_xstrdup in TUI Date: Tue, 10 Sep 2019 13:08:56 -0600 Message-Id: <20190910190857.6562-20-tom@tromey.com> In-Reply-To: <20190910190857.6562-1-tom@tromey.com> References: <20190910190857.6562-1-tom@tromey.com> This changes a couple of spots in the TUI to use make_unique_xstrdup. This simplifies the code slightly. gdb/ChangeLog 2019-09-10 Tom Tromey * tui/tui-source.c (tui_source_window::set_contents): Use make_unique_xstrdup. * tui/tui-disasm.c (tui_disasm_window::set_contents): Use make_unique_xstrdup. --- gdb/ChangeLog | 7 +++++++ gdb/tui/tui-disasm.c | 2 +- gdb/tui/tui-source.c | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c index 53ea061afb6..51616bcf874 100644 --- a/gdb/tui/tui-disasm.c +++ b/gdb/tui/tui-disasm.c @@ -218,7 +218,7 @@ tui_disasm_window::set_contents (struct gdbarch *arch, if (line.size() > offset) src->line.reset (xstrndup (&line[offset], line_width)); else - src->line.reset (xstrdup ("")); + src->line = make_unique_xstrdup (""); src->line_or_addr.loa = LOA_ADDRESS; src->line_or_addr.u.addr = asm_lines[i].addr; diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c index fa6ed7893fe..bb1013bb869 100644 --- a/gdb/tui/tui-source.c +++ b/gdb/tui/tui-source.c @@ -183,7 +183,7 @@ tui_source_window::set_contents (struct gdbarch *arch, symtab_to_fullname (s)) == 0 && cur_line_no == locator->line_no); - content[cur_line].line.reset (xstrdup (text.c_str ())); + content[cur_line].line = make_unique_xstrdup (text.c_str ()); cur_line++; cur_line_no++;