From be0d7abb5e3b0be4cb928845e70a9134f1b19700 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sun, 13 Aug 2017 14:40:46 -0600 Subject: Replace interp_set_temp with scoped_restore_interp This removes interp_set_temp and an associated cleanup, in favor of a new RAII class, scoped_restore_interp. ChangeLog 2017-09-11 Tom Tromey * cli/cli-script.c (restore_interp): Remove. (read_command_lines): Use scoped_restore_interp. * interps.c (scoped_restore_interp::set_temp): Rename from interp_set_temp. * interps.h (class scoped_restore_interp): New. (interp_set_temp): Remove. --- gdb/cli/cli-script.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'gdb/cli/cli-script.c') diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c index 02f66cc..dc3e856 100644 --- a/gdb/cli/cli-script.c +++ b/gdb/cli/cli-script.c @@ -1158,12 +1158,6 @@ recurse_read_control_structure (char * (*read_next_line_func) (void), return ret; } -static void -restore_interp (void *arg) -{ - interp_set_temp (interp_name ((struct interp *)arg)); -} - /* Read lines from the input stream and accumulate them in a chain of struct command_line's, which is then returned. For input from a terminal, the special command "end" is used to mark the end of the @@ -1203,12 +1197,10 @@ read_command_lines (char *prompt_arg, int from_tty, int parse_commands, validator, closure); else { - struct interp *old_interp = interp_set_temp (INTERP_CONSOLE); - struct cleanup *old_chain = make_cleanup (restore_interp, old_interp); + scoped_restore_interp interp_restorer (INTERP_CONSOLE); head = read_command_lines_1 (read_next_line, parse_commands, validator, closure); - do_cleanups (old_chain); } if (from_tty && input_interactive_p (current_ui) -- cgit v1.1