[PATCH v2 12/31] Use ui_file_as_string in gdb/utils.c

Pedro Alves palves@redhat.com
Wed Oct 19 01:12:00 GMT 2016


gdb/ChangeLog:
yyyy-mm-yy  Pedro Alves  <palves@redhat.com>

	* utils.c (error_stream): Use ui_file_as_string and std::string.
---
 gdb/utils.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/gdb/utils.c b/gdb/utils.c
index 71c0e00..6feeb4d 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -509,10 +509,9 @@ verror (const char *string, va_list args)
 void
 error_stream (struct ui_file *stream)
 {
-  char *message = ui_file_xstrdup (stream, NULL);
+  std::string message = ui_file_as_string (stream);
 
-  make_cleanup (xfree, message);
-  error (("%s"), message);
+  error (("%s"), message.c_str ());
 }
 
 /* Emit a message and abort.  */
-- 
2.5.5



More information about the Gdb-patches mailing list