[RFA 12/23] More uses of scoped_restore
Pedro Alves
palves@redhat.com
Fri Jun 2 18:31:00 GMT 2017
On 05/03/2017 11:46 PM, Tom Tromey wrote:
> @@ -8635,7 +8614,8 @@ remote_serial_write (const char *str, int len)
> struct remote_state *rs = get_remote_state ();
> struct cleanup *old_chain;
This cleanup variable can be removed.
>
> - old_chain = make_cleanup_override_quit_handler (remote_serial_quit_handler);
> + scoped_restore restore_quit
> + = make_scoped_restore (&quit_handler, remote_serial_quit_handler);
>
> rs->got_ctrlc_during_io = 0;
>
> @@ -56,12 +47,11 @@ exec_reverse_once (const char *cmd, char *args, int from_tty)
> if (!target_can_execute_reverse)
> error (_("Target %s does not support this command."), target_shortname);
>
> - reverse_command = xstrprintf ("%s %s", cmd, args ? args : "");
> - old_chain = make_cleanup (exec_direction_default, NULL);
> - make_cleanup (xfree, reverse_command);
> + std::string reverse_command = string_printf ("%s %s", cmd, args ? args : "");
> + scoped_restore restore_exec_dir
> + = make_scoped_restore (&execution_direction, EXEC_REVERSE);
> execution_direction = EXEC_REVERSE;
This assignment is now unnecessary.
OK with those changes.
Thanks,
Pedro Alves
More information about the Gdb-patches
mailing list