From: Simon Marchi <simark@simark.ca>
To: Tom Tromey <tom@tromey.com>,
Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: Re: [PATCH] gdb: make inferior::terminal a unique ptr
Date: Thu, 25 Jun 2020 17:07:14 -0400 [thread overview]
Message-ID: <a5fc822e-3ea1-d958-e6bc-7a9936b3e298@simark.ca> (raw)
In-Reply-To: <87zh8qewbj.fsf@tromey.com>
On 2020-06-25 4:15 p.m., Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
>
> Simon> - current_inferior ()->terminal = xstrdup (terminal_name);
> Simon> + current_inferior ()->terminal.reset (xstrdup (terminal_name));
>
> You can use make_unique_xstrdup and avoid the call to reset, in favor of
> move assignment.
>
> Tom
>
Good catch. I pushed the following patch that does it.
From 58373b80f3d06740fccefe735fbb390791092027 Mon Sep 17 00:00:00 2001
From: Simon Marchi <simon.marchi@efficios.com>
Date: Thu, 25 Jun 2020 17:06:18 -0400
Subject: [PATCH] gdb: use make_unique_xstrdup in set_inferior_io_terminal
gdb/ChangeLog:
* infcmd.c (set_inferior_io_terminal): Use make_unique_xstrdup.
Change-Id: I38b6e753f58947531fe4a293d574bc27ec128f47
---
gdb/ChangeLog | 4 ++++
gdb/infcmd.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d9b6a49bd105..ddb5c47d1e75 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2020-06-25 Simon Marchi <simon.marchi@efficios.com>
+
+ * infcmd.c (set_inferior_io_terminal): Use make_unique_xstrdup.
+
2020-06-25 Simon Marchi <simon.marchi@efficios.com>
* inferior.h (struct inferior) <terminal>: Change type to
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 48d6a91c0c24..17f7b9abeac3 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -109,7 +109,7 @@ void
set_inferior_io_terminal (const char *terminal_name)
{
if (terminal_name != NULL && *terminal_name != '\0')
- current_inferior ()->terminal.reset (xstrdup (terminal_name));
+ current_inferior ()->terminal = make_unique_xstrdup (terminal_name);
else
current_inferior ()->terminal = NULL;
}
--
2.26.2
next prev parent reply other threads:[~2020-06-25 21:07 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-25 15:55 Simon Marchi
2020-06-25 17:18 ` Christian Biesinger
2020-06-25 17:28 ` Pedro Alves
2020-06-25 17:59 ` Luis Machado
2020-06-25 18:09 ` Pedro Alves
2020-06-25 18:39 ` Simon Marchi
2020-06-25 21:20 ` Christian Biesinger
2020-06-25 17:32 ` Pedro Alves
2020-06-25 18:42 ` Simon Marchi
2020-06-25 21:17 ` Pedro Alves
2020-06-25 20:15 ` Tom Tromey
2020-06-25 21:07 ` Simon Marchi [this message]
2020-06-25 21:45 ` Tom Tromey
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=a5fc822e-3ea1-d958-e6bc-7a9936b3e298@simark.ca \
--to=simark@simark.ca \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@efficios.com \
--cc=tom@tromey.com \
/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