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 gdbarch.sh/gdbarch.c


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

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

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

Diff:
---
 gdb/ChangeLog  | 6 ++++++
 gdb/gdbarch.c  | 8 +++-----
 gdb/gdbarch.sh | 8 +++-----
 3 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5e83034..cb0e774 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
 2016-11-08  Pedro Alves  <palves@redhat.com>
 
+	* gdbarch.sh (verify_gdbarch): Use ui_file_as_string and
+	std::string.
+	* gdbarch.c: Regenerate.
+
+2016-11-08  Pedro Alves  <palves@redhat.com>
+
 	* c-exp.y (OPERATOR NEW): Adjust to use ui_file_as_string and
 	std::string.
 
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 0c800c5..07b3ce5 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -500,7 +500,6 @@ verify_gdbarch (struct gdbarch *gdbarch)
   struct ui_file *log;
   struct cleanup *cleanups;
   long length;
-  char *buf;
 
   log = mem_fileopen ();
   cleanups = make_cleanup_ui_file_delete (log);
@@ -697,12 +696,11 @@ verify_gdbarch (struct gdbarch *gdbarch)
   /* Skip verify of gcc_target_options, invalid_p == 0 */
   /* Skip verify of gnu_triplet_regexp, invalid_p == 0 */
   /* Skip verify of addressable_memory_unit_size, invalid_p == 0 */
-  buf = ui_file_xstrdup (log, &length);
-  make_cleanup (xfree, buf);
-  if (length > 0)
+  std::string buf = ui_file_as_string (log);
+  if (!buf.empty ())
     internal_error (__FILE__, __LINE__,
                     _("verify_gdbarch: the following are invalid ...%s"),
-                    buf);
+                    buf.c_str ());
   do_cleanups (cleanups);
 }
 
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 9b94703..28a3478 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -1878,7 +1878,6 @@ verify_gdbarch (struct gdbarch *gdbarch)
   struct ui_file *log;
   struct cleanup *cleanups;
   long length;
-  char *buf;
 
   log = mem_fileopen ();
   cleanups = make_cleanup_ui_file_delete (log);
@@ -1924,12 +1923,11 @@ do
     fi
 done
 cat <<EOF
-  buf = ui_file_xstrdup (log, &length);
-  make_cleanup (xfree, buf);
-  if (length > 0)
+  std::string buf = ui_file_as_string (log);
+  if (!buf.empty ())
     internal_error (__FILE__, __LINE__,
                     _("verify_gdbarch: the following are invalid ...%s"),
-                    buf);
+                    buf.c_str ());
   do_cleanups (cleanups);
 }
 EOF


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