This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA 7/8] Use unique_xmalloc_ptr in execute_gdb_command
- From: Pedro Alves <palves at redhat dot com>
- To: Tom Tromey <tom at tromey dot com>, gdb-patches at sourceware dot org
- Date: Fri, 2 Dec 2016 14:49:30 +0000
- Subject: Re: [RFA 7/8] Use unique_xmalloc_ptr in execute_gdb_command
- Authentication-results: sourceware.org; auth=none
- References: <1480395946-10924-1-git-send-email-tom@tromey.com> <1480395946-10924-8-git-send-email-tom@tromey.com>
On 11/29/2016 05:05 AM, Tom Tromey wrote:
> This replaces a cleanup in execute_gdb_command with an instance of
> unique_xmalloc_ptr. std::string was not used because execute_command
> and execute_command_to_string don't accept a "const char *" (in fact
> the reason for copying the string at all).
You can do:
std::string copy (arg);
...
to_string_res = execute_command_to_string (©[0], from_tty);
That's fine in C++11.
Thanks,
Pedro Alves