This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Use ui_file_as_string in gdb/xtensa-tdep.c
- From: Pedro Alves <palves at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 8 Nov 2016 15:29:53 -0000
- Subject: [binutils-gdb] Use ui_file_as_string in gdb/xtensa-tdep.c
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a0f86e735886f3d373507fa9cfc0cf2a2f32eabc
commit a0f86e735886f3d373507fa9cfc0cf2a2f32eabc
Author: Pedro Alves <palves@redhat.com>
Date: Tue Nov 8 15:26:44 2016 +0000
Use ui_file_as_string in gdb/xtensa-tdep.c
gdb/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>
* xtensa-tdep.c (xtensa_verify_config): Use ui_file_as_string and
std::string.
Diff:
---
gdb/ChangeLog | 5 +++++
gdb/xtensa-tdep.c | 9 +++------
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index dbf4eb3..1217550 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2016-11-08 Pedro Alves <palves@redhat.com>
+ * xtensa-tdep.c (xtensa_verify_config): Use ui_file_as_string and
+ std::string.
+
+2016-11-08 Pedro Alves <palves@redhat.com>
+
* dwarf2read.c (dwarf2_compute_name): Use ui_file_as_string and
std::string.
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index 3c9c015..e47c90a 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -3066,8 +3066,6 @@ xtensa_verify_config (struct gdbarch *gdbarch)
struct ui_file *log;
struct cleanup *cleanups;
struct gdbarch_tdep *tdep;
- long length;
- char *buf;
tdep = gdbarch_tdep (gdbarch);
log = mem_fileopen ();
@@ -3099,11 +3097,10 @@ xtensa_verify_config (struct gdbarch *gdbarch)
if (tdep->a0_base == -1)
fprintf_unfiltered (log, _("\n\ta0_base: No Ax registers"));
- 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__,
- _("the following are invalid: %s"), buf);
+ _("the following are invalid: %s"), buf.c_str ());
do_cleanups (cleanups);
}