Re: [RFA 17/23] Use a scoped_restore for user_call_depth

Pedro Alves
2017-06-05T13:32:52Z

On 05/03/2017 11:46 PM, Tom Tromey wrote:

> -
> void
> execute_user_command (struct cmd_list_element *c, char *args)
> {
> @@ -398,15 +388,15 @@ execute_user_command (struct cmd_list_element *c, char *args)
> return;
>
> scoped_user_args_level push_user_args (args);
> + scoped_restore restore_call_depth
> + = make_scoped_restore (&user_call_depth, user_call_depth + 1);
>
> - if (++user_call_depth > max_user_call_depth)
> + if (user_call_depth > max_user_call_depth)
> error (_("Max user call depth exceeded -- command aborted."));
>

How about we remove the user_call_depth variable and check
user_args_stack.size () instead ?

Thanks,
Pedro Alves