summaryrefslogtreecommitdiff
path: root/gdb/top.c
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/top.c
parentb7b633e9b13fc5697af035f4504c9790c612a8c7 (diff)
downloadbinutils-gdb-9746809447893fd4672ea6babf4e961157cb541d.tar.gz
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/top.c')
-rw-r--r--gdb/top.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/gdb/top.c b/gdb/top.c
index 120d751d0ec..053c510333f 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -706,22 +706,22 @@ execute_command_to_string (char *p, int from_tty)
str_file = mem_fileopen ();
make_cleanup_ui_file_delete (str_file);
- make_cleanup_restore_ui_file (&gdb_stdout);
- make_cleanup_restore_ui_file (&gdb_stderr);
- make_cleanup_restore_ui_file (&gdb_stdlog);
- make_cleanup_restore_ui_file (&gdb_stdtarg);
- make_cleanup_restore_ui_file (&gdb_stdtargerr);
if (ui_out_redirect (current_uiout, str_file) < 0)
warning (_("Current output protocol does not support redirection"));
else
make_cleanup_ui_out_redirect_pop (current_uiout);
- gdb_stdout = str_file;
- gdb_stderr = str_file;
- gdb_stdlog = str_file;
- gdb_stdtarg = str_file;
- gdb_stdtargerr = str_file;
+ scoped_restore save_stdout
+ = make_scoped_restore (&gdb_stdout, str_file);
+ scoped_restore save_stderr
+ = make_scoped_restore (&gdb_stderr, str_file);
+ scoped_restore save_stdlog
+ = make_scoped_restore (&gdb_stdlog, str_file);
+ scoped_restore save_stdtarg
+ = make_scoped_restore (&gdb_stdtarg, str_file);
+ scoped_restore save_stdtargerr
+ = make_scoped_restore (&gdb_stdtargerr, str_file);
execute_command (p, from_tty);