[PATCH] Introduce and use make_unique_xstrdup

Pedro Alves palves@redhat.com
Tue Jun 4 21:51:00 GMT 2019


On 6/4/19 7:59 PM, Tom Tromey wrote:
>>>>>> "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!

I've pushed this one in.

Thanks,
Pedro Alves



More information about the Gdb-patches mailing list