aboutsummaryrefslogtreecommitdiff
path: root/gdb/ui-out.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2016-11-08 15:26:44 +0000
committerPedro Alves <palves@redhat.com>2016-11-08 15:26:44 +0000
commit56dbf31760f721893a44d3da26adfccf548995c7 (patch)
tree7d0d048345c2cd90d435a624f51510e8db60d5ac /gdb/ui-out.c
parent77e1c7426aad05b20f48762234c02139e9c02f8e (diff)
downloadgdb-56dbf31760f721893a44d3da26adfccf548995c7.zip
gdb-56dbf31760f721893a44d3da26adfccf548995c7.tar.gz
gdb-56dbf31760f721893a44d3da26adfccf548995c7.tar.bz2
Use ui_file_as_string in gdb/ui-out.c
gdb/ChangeLog: 2016-11-08 Pedro Alves <palves@redhat.com> * ui-out.c (ui_out_field_stream): Use ui_file_as_string.
Diffstat (limited to 'gdb/ui-out.c')
-rw-r--r--gdb/ui-out.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/gdb/ui-out.c b/gdb/ui-out.c
index 0eaa48f..60d18ee 100644
--- a/gdb/ui-out.c
+++ b/gdb/ui-out.c
@@ -425,16 +425,13 @@ ui_out_field_stream (struct ui_out *uiout,
const char *fldname,
struct ui_file *stream)
{
- long length;
- char *buffer = ui_file_xstrdup (stream, &length);
- struct cleanup *old_cleanup = make_cleanup (xfree, buffer);
+ std::string buffer = ui_file_as_string (stream);
- if (length > 0)
- ui_out_field_string (uiout, fldname, buffer);
+ if (!buffer.empty ())
+ ui_out_field_string (uiout, fldname, buffer.c_str ());
else
ui_out_field_skip (uiout, fldname);
ui_file_rewind (stream);
- do_cleanups (old_cleanup);
}
/* Used to omit a field. */