This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH v2 17/31] Use ui_file_as_string in gdb/printcmd.c
- From: Pedro Alves <palves at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Wed, 19 Oct 2016 02:12:05 +0100
- Subject: [PATCH v2 17/31] Use ui_file_as_string in gdb/printcmd.c
- Authentication-results: sourceware.org; auth=none
- References: <1476839539-8374-1-git-send-email-palves@redhat.com>
Yet another cleanup eliminated.
gdb/ChangeLog:
yyyy-mm-yy Pedro Alves <palves@redhat.com>
* printcmd.c (eval_command): Use ui_file_as_string and
std::string.
---
gdb/printcmd.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index aa51848..d909823 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -2721,14 +2721,12 @@ eval_command (char *arg, int from_tty)
{
struct ui_file *ui_out = mem_fileopen ();
struct cleanup *cleanups = make_cleanup_ui_file_delete (ui_out);
- char *expanded;
ui_printf (arg, ui_out);
- expanded = ui_file_xstrdup (ui_out, NULL);
- make_cleanup (xfree, expanded);
+ std::string expanded = ui_file_as_string (ui_out);
- execute_command (expanded, from_tty);
+ execute_command (&expanded[0], from_tty);
do_cleanups (cleanups);
}
--
2.5.5