Use ui_file_as_string in gdb/infrun.c
authorPedro Alves <palves@redhat.com>
Tue, 8 Nov 2016 15:26:46 +0000 (15:26 +0000)
committerPedro Alves <palves@redhat.com>
Tue, 8 Nov 2016 15:26:46 +0000 (15:26 +0000)
gdb/ChangeLog:
2016-11-08  Pedro Alves  <palves@redhat.com>

* infrun.c (print_target_wait_results): Use ui_file_as_string and
std::string.

gdb/ChangeLog
gdb/infrun.c

index bfd58d7392e978c5afdb693cf716d3f72f44d462..361b8abec3850a1c66d037a0f1aa6186498399af 100644 (file)
@@ -1,3 +1,8 @@
+2016-11-08  Pedro Alves  <palves@redhat.com>
+
+       * infrun.c (print_target_wait_results): Use ui_file_as_string and
+       std::string.
+
 2016-11-08  Pedro Alves  <palves@redhat.com>
 
        * ada-lang.c (type_as_string): Use ui_file_as_string and return
index 19e80441290b009a568cd223d74d58a7b3d60db3..bf0632eaad2ea5551d69e4597585ad02d654cdb8 100644 (file)
@@ -3437,7 +3437,6 @@ print_target_wait_results (ptid_t waiton_ptid, ptid_t result_ptid,
 {
   char *status_string = target_waitstatus_to_string (ws);
   struct ui_file *tmp_stream = mem_fileopen ();
-  char *text;
 
   /* The text is split over several lines because it was getting too long.
      Call fprintf_unfiltered (gdb_stdlog) once so that the text is still
@@ -3463,14 +3462,13 @@ print_target_wait_results (ptid_t waiton_ptid, ptid_t result_ptid,
                      "infrun:   %s\n",
                      status_string);
 
-  text = ui_file_xstrdup (tmp_stream, NULL);
+  std::string text = ui_file_as_string (tmp_stream);
 
   /* This uses %s in part to handle %'s in the text, but also to avoid
      a gcc error: the format attribute requires a string literal.  */
-  fprintf_unfiltered (gdb_stdlog, "%s", text);
+  fprintf_unfiltered (gdb_stdlog, "%s", text.c_str ());
 
   xfree (status_string);
-  xfree (text);
   ui_file_delete (tmp_stream);
 }
 
This page took 0.036359 seconds and 4 git commands to generate.