+2017-08-03 Tom Tromey <tom@tromey.com>
+
+ * cli/cli-script.c (execute_user_command)
+ (execute_control_command): Use scoped_restore.
+
2017-08-03 Tom Tromey <tom@tromey.com>
* cli/cli-script.c (do_restore_user_call_depth): Remove.
scoped_restore save_async = make_scoped_restore (¤t_ui->async, 0);
- command_nest_depth++;
+ scoped_restore save_nesting
+ = make_scoped_restore (&command_nest_depth, command_nest_depth + 1);
while (cmdlines)
{
ret = execute_control_command (cmdlines);
}
cmdlines = cmdlines->next;
}
- command_nest_depth--;
do_cleanups (old_chain);
}
current = *cmd->body_list;
while (current)
{
- command_nest_depth++;
+ scoped_restore save_nesting
+ = make_scoped_restore (&command_nest_depth, command_nest_depth + 1);
ret = execute_control_command (current);
- command_nest_depth--;
/* If we got an error, or a "break" command, then stop
looping. */
/* Execute commands in the given arm. */
while (current)
{
- command_nest_depth++;
+ scoped_restore save_nesting
+ = make_scoped_restore (&command_nest_depth, command_nest_depth + 1);
ret = execute_control_command (current);
- command_nest_depth--;
/* If we got an error, get out. */
if (ret != simple_control)