summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2016-10-17 14:11:27 +0100
committerPedro Alves <palves@redhat.com>2016-10-17 14:39:38 +0100
commit68405497f1096193068019c4fbd8f9f637256ee7 (patch)
tree90a034157a2f374b249b91932aa67f4bccb53ae4
parent4eb09a503fe5dc5caae8a1e0f8478f356083eaa6 (diff)
downloadbinutils-gdb-68405497f1096193068019c4fbd8f9f637256ee7.tar.gz
Use ui_file_as_string in gdbarch.sh/gdbarch.c
gdb/ChangeLog: yyyy-mm-yy Pedro Alves <palves@redhat.com> * gdbarch.sh (verify_gdbarch): Use ui_file_as_string and std::string. * gdbarch.c: Regenerate.
-rw-r--r--gdb/gdbarch.c8
-rwxr-xr-xgdb/gdbarch.sh8
2 files changed, 6 insertions, 10 deletions
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 4d8ef183cde..da4aa25ae1b 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -496,7 +496,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);
@@ -691,12 +690,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 16631560571..036786eec8a 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -1867,7 +1867,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);
@@ -1913,12 +1912,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