aboutsummaryrefslogtreecommitdiff
path: root/gdb/guile
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2016-09-22 20:33:30 -0600
committerTom Tromey <tom@tromey.com>2016-10-21 14:17:32 -0600
commit9746809447893fd4672ea6babf4e961157cb541d (patch)
tree0d82c7443e54ba27007cf112c1ae506872bb4949 /gdb/guile
parentb7b633e9b13fc5697af035f4504c9790c612a8c7 (diff)
downloadgdb-9746809447893fd4672ea6babf4e961157cb541d.zip
gdb-9746809447893fd4672ea6babf4e961157cb541d.tar.gz
gdb-9746809447893fd4672ea6babf4e961157cb541d.tar.bz2
Use scoped_restore for ui_file
This replaces all the uses of make_cleanup_restore_ui_file with scoped_restore. 2016-10-21 Tom Tromey <tom@tromey.com> * utils.c (make_cleanup_restore_ui_file, do_restore_ui_file) (struct restore_ui_file_closure): Remove. * utils.h (make_cleanup_restore_ui_file): Don't declare. * guile/scm-ports.c (ioscm_with_output_to_port_worker): Use scoped_restore. * top.c (execute_command_to_string): Use scoped_restore.
Diffstat (limited to 'gdb/guile')
-rw-r--r--gdb/guile/scm-ports.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/gdb/guile/scm-ports.c b/gdb/guile/scm-ports.c
index 5559475..dea9077 100644
--- a/gdb/guile/scm-ports.c
+++ b/gdb/guile/scm-ports.c
@@ -524,15 +524,13 @@ ioscm_with_output_to_port_worker (SCM port, SCM thunk, enum oport oport,
make_cleanup_ui_file_delete (port_file);
+ scoped_restore save_file = make_scoped_restore (oport == GDB_STDERR
+ ? &gdb_stderr : &gdb_stdout);
+
if (oport == GDB_STDERR)
- {
- make_cleanup_restore_ui_file (&gdb_stderr);
- gdb_stderr = port_file;
- }
+ gdb_stderr = port_file;
else
{
- make_cleanup_restore_ui_file (&gdb_stdout);
-
if (ui_out_redirect (current_uiout, port_file) < 0)
warning (_("Current output protocol does not support redirection"));
else