diff options
author | Pedro Alves <palves@redhat.com> | 2016-10-17 14:11:25 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2016-10-17 14:39:38 +0100 |
commit | a28fcc81edf6c97488e27cb8fe64631641119100 (patch) | |
tree | b6430b949da79165e1e0daf56e8224b075b563d3 | |
parent | c4eec609b538541b28a4ec843f1c01b5f002bdfa (diff) | |
download | binutils-gdb-a28fcc81edf6c97488e27cb8fe64631641119100.tar.gz |
Use ui_file_as_string in ui-out.c
gdb/ChangeLog:
yyyy-mm-yy Pedro Alves <palves@redhat.com>
* ui-out.c (ui_out_field_stream): Use ui_file_as_string.
-rw-r--r-- | gdb/ui-out.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/gdb/ui-out.c b/gdb/ui-out.c index f6d60504148..9b1df3cd4e2 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. */ |