aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2016-11-08 15:26:46 +0000
committerPedro Alves <palves@redhat.com>2016-11-08 15:26:46 +0000
commitaf1fe7b3b87de27d84a82d4f44b937c2800205ff (patch)
tree2c2ea3fc0959a72894f70dcb5f07da905a2361d4
parent3b4de39c9d9ff014ae90e2bafbf7ce1f42c2198e (diff)
downloadgdb-af1fe7b3b87de27d84a82d4f44b937c2800205ff.zip
gdb-af1fe7b3b87de27d84a82d4f44b937c2800205ff.tar.gz
gdb-af1fe7b3b87de27d84a82d4f44b937c2800205ff.tar.bz2
Use ui_file_as_string in gdb/infrun.c
gdb/ChangeLog: 2016-11-08 Pedro Alves <palves@redhat.com> * infrun.c (print_target_wait_results): Use ui_file_as_string and std::string.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/infrun.c6
2 files changed, 7 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index bfd58d7..361b8ab 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
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
std::string.
(type_as_string_and_cleanup): Delete.
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 19e8044..bf0632e 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -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);
}