public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tom Tromey <tromey@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] Use make_unique_xstrdup in TUI
Date: Fri, 20 Sep 2019 20:07:00 -0000	[thread overview]
Message-ID: <20190920200718.70980.qmail@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f074b67ec812612637342a1647da9158a1e77de0

commit f074b67ec812612637342a1647da9158a1e77de0
Author: Tom Tromey <tom@tromey.com>
Date:   Tue Sep 10 12:56:09 2019 -0600

    Use make_unique_xstrdup in TUI
    
    This changes a couple of spots in the TUI to use make_unique_xstrdup.
    This simplifies the code slightly.
    
    gdb/ChangeLog
    2019-09-20  Tom Tromey  <tom@tromey.com>
    
    	* 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.

Diff:
---
 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/ChangeLog b/gdb/ChangeLog
index 8f69dc5..402b57a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
 2019-09-20  Tom Tromey  <tom@tromey.com>
 
+	* 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.
+
+2019-09-20  Tom Tromey  <tom@tromey.com>
+
 	* tui/tui-data.c: Remove separator comments.
 	* tui/tui-layout.c: Remove separator comments.
 	* tui/tui-win.c: Remove separator comments.
diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c
index 53ea061..51616bc 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 fa6ed78..bb1013b 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++;


                 reply	other threads:[~2019-09-20 20:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190920200718.70980.qmail@sourceware.org \
    --to=tromey@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).