This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Introduce and use make_unique_xstrdup
- From: Tom Tromey <tom at tromey dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: Tom Tromey <tom at tromey dot com>, gdb-patches at sourceware dot org
- Date: Tue, 04 Jun 2019 12:59:42 -0600
- Subject: Re: [PATCH] Introduce and use make_unique_xstrdup
- References: <20190530195333.20448-1-palves@redhat.com> <20190530195333.20448-13-palves@redhat.com> <874l56mqd3.fsf@tromey.com> <486723fe-f8df-0499-a22a-b4fb1e6f9fff@redhat.com>
>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
Pedro> On 6/3/19 8:16 PM, Tom Tromey wrote:
Pedro> +/* Dup STR and return a unique_xmalloc_ptr for the result. */
Pedro> +
Pedro> +static gdb::unique_xmalloc_ptr<char>
Pedro> +make_unique_xstrdup (const char *str)
Pedro> +{
Pedro> + return gdb::unique_xmalloc_ptr<char> (xstrdup (str));
Pedro> +}
>>
>> I could 25 spots that could use this, so how about putting it into a
>> header somewhere? I am happy to convert all the existing uses.
Pedro> Yeah. I added a bunch of those spots myself, and been meaning to do
Pedro> this.
Pedro> How about this?
Looks good to me, thanks!
Tom