Use ui_file_as_string in gdb/printcmd.c
authorPedro Alves <palves@redhat.com>
Tue, 8 Nov 2016 15:26:45 +0000 (15:26 +0000)
committerPedro Alves <palves@redhat.com>
Tue, 8 Nov 2016 15:26:45 +0000 (15:26 +0000)
Yet another cleanup eliminated.

gdb/ChangeLog:
2016-11-08  Pedro Alves  <palves@redhat.com>

* printcmd.c (eval_command): Use ui_file_as_string and
std::string.

gdb/ChangeLog
gdb/printcmd.c

index 08699ed10eed33994a1a97f32f0565c8cfb5d6be..254893f94f616439e09d99aa283cd3f67879122c 100644 (file)
@@ -1,3 +1,8 @@
+2016-11-08  Pedro Alves  <palves@redhat.com>
+
+       * printcmd.c (eval_command): Use ui_file_as_string and
+       std::string.
+
 2016-11-08  Pedro Alves  <palves@redhat.com>
 
        * top.c (quit_confirm): Use ui_file_as_string and std::string.
index b70ed19f98b021cd56480ca864b8d62f5b0d7071..23de57cb2137b3ea87d0da603259b6be4e68064a 100644 (file)
@@ -2719,14 +2719,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);
 }