This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH v2 09/31] Use ui_file_as_string in gdb/xtensa-tdep.c
- From: Pedro Alves <palves at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Wed, 19 Oct 2016 02:11:57 +0100
- Subject: [PATCH v2 09/31] Use ui_file_as_string in gdb/xtensa-tdep.c
- Authentication-results: sourceware.org; auth=none
- References: <1476839539-8374-1-git-send-email-palves@redhat.com>
gdb/ChangeLog:
yyyy-mm-yy Pedro Alves <palves@redhat.com>
* xtensa-tdep.c (xtensa_verify_config): Use ui_file_as_string and
std::string.
---
gdb/xtensa-tdep.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index aafb175..68890ff 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -3065,8 +3065,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 ();
@@ -3098,11 +3096,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);
}
--
2.5.5