aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli/cli-interp.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-04-29 23:12:04 -0600
committerTom Tromey <tom@tromey.com>2018-05-25 12:41:00 -0600
commit753ff9bd837e2ba183e3ff789847a81221561392 (patch)
tree8e8394abbe5a01569ad1a04663851af629f4ed3a /gdb/cli/cli-interp.c
parent5ca3b2605cc9ab5b33032c6478147366be60cd95 (diff)
downloadbinutils-753ff9bd837e2ba183e3ff789847a81221561392.zip
binutils-753ff9bd837e2ba183e3ff789847a81221561392.tar.gz
binutils-753ff9bd837e2ba183e3ff789847a81221561392.tar.bz2
Use scoped_restore in a couple of interp-related places
While looking through the "interp" code I found a couple of spots that could use scoped_restore. ChangeLog 2018-05-25 Tom Tromey <tom@tromey.com> * cli/cli-interp.c (safe_execute_command): Use scoped_restore. * interps.c (interp_exec): Use scoped_restore.
Diffstat (limited to 'gdb/cli/cli-interp.c')
-rw-r--r--gdb/cli/cli-interp.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/gdb/cli/cli-interp.c b/gdb/cli/cli-interp.c
index bbee809..0663301 100644
--- a/gdb/cli/cli-interp.c
+++ b/gdb/cli/cli-interp.c
@@ -356,11 +356,10 @@ safe_execute_command (struct ui_out *command_uiout, const char *command,
int from_tty)
{
struct gdb_exception e = exception_none;
- struct ui_out *saved_uiout;
/* Save and override the global ``struct ui_out'' builder. */
- saved_uiout = current_uiout;
- current_uiout = command_uiout;
+ scoped_restore saved_uiout = make_scoped_restore (&current_uiout,
+ command_uiout);
TRY
{
@@ -372,9 +371,6 @@ safe_execute_command (struct ui_out *command_uiout, const char *command,
}
END_CATCH
- /* Restore the global builder. */
- current_uiout = saved_uiout;
-
/* FIXME: cagney/2005-01-13: This shouldn't be needed. Instead the
caller should print the exception. */
exception_print (gdb_stderr, e);