summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2016-10-17 14:11:27 +0100
committerPedro Alves <palves@redhat.com>2016-10-17 14:39:38 +0100
commit149423bfc220c60e16efe8cc27571d8bf1471862 (patch)
tree58e6cb01507af82f2d96e0041c596884769b4151
parentd26a02f5e7fa09834815fc52e086a06b8918b607 (diff)
downloadbinutils-gdb-149423bfc220c60e16efe8cc27571d8bf1471862.tar.gz
Use ui_file_as_string in gdb/infrun.c
gdb/ChangeLog: yyyy-mm-yy Pedro Alves <palves@redhat.com> * infrun.c (print_target_wait_results): Use ui_file_as_string and std::string.
-rw-r--r--gdb/infrun.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 2636a19f9b1..2fa6449345b 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -3433,7 +3433,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
@@ -3459,14 +3458,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);
}