This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH v2 16/31] Use ui_file_as_string in gdb/top.c
- From: Pedro Alves <palves at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Wed, 19 Oct 2016 02:12:04 +0100
- Subject: [PATCH v2 16/31] Use ui_file_as_string in gdb/top.c
- Authentication-results: sourceware.org; auth=none
- References: <1476839539-8374-1-git-send-email-palves@redhat.com>
Yet another cleanup is eliminated.
gdb/ChangeLog:
yyyy-mm-dd Pedro Alves <palves@redhat.com>
* top.c (quit_confirm): Use ui_file_as_string and std::string.
---
gdb/top.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/gdb/top.c b/gdb/top.c
index 762a9a8..4fa9cfb 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1577,8 +1577,6 @@ quit_confirm (void)
{
struct ui_file *stb;
struct cleanup *old_chain;
- char *str;
- int qr;
/* Don't even ask if we're only debugging a core file inferior. */
if (!have_live_inferiors ())
@@ -1592,12 +1590,11 @@ quit_confirm (void)
iterate_over_inferiors (print_inferior_quit_action, stb);
fprintf_filtered (stb, _("\nQuit anyway? "));
- str = ui_file_xstrdup (stb, NULL);
- make_cleanup (xfree, str);
+ std::string str = ui_file_as_string (stb);
- qr = query ("%s", str);
do_cleanups (old_chain);
- return qr;
+
+ return query ("%s", str.c_str ());
}
/* Prepare to exit GDB cleanly by undoing any changes made to the
--
2.5.5