This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Use ui_file_as_string in gdb/utils.c


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d16c5475b560adbad2d9bc78ec3718658f4090e3

commit d16c5475b560adbad2d9bc78ec3718658f4090e3
Author: Pedro Alves <palves@redhat.com>
Date:   Tue Nov 8 15:26:44 2016 +0000

    Use ui_file_as_string in gdb/utils.c
    
    gdb/ChangeLog:
    2016-11-08  Pedro Alves  <palves@redhat.com>
    
    	* utils.c (error_stream): Use ui_file_as_string and std::string.

Diff:
---
 gdb/ChangeLog | 4 ++++
 gdb/utils.c   | 5 ++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 7855776..769187f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
 2016-11-08  Pedro Alves  <palves@redhat.com>
 
+	* utils.c (error_stream): Use ui_file_as_string and std::string.
+
+2016-11-08  Pedro Alves  <palves@redhat.com>
+
 	* ui-out.c (ui_out_field_stream): Use ui_file_as_string.
 
 2016-11-08  Pedro Alves  <palves@redhat.com>
diff --git a/gdb/utils.c b/gdb/utils.c
index c7ba051..751f099 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -480,10 +480,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.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]