This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA 12/23] More uses of scoped_restore
- From: Pedro Alves <palves at redhat dot com>
- To: Tom Tromey <tom at tromey dot com>, gdb-patches at sourceware dot org
- Date: Fri, 2 Jun 2017 19:31:49 +0100
- Subject: Re: [RFA 12/23] More uses of scoped_restore
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=palves at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 1BC88334584
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1BC88334584
- References: <20170503224626.2818-1-tom@tromey.com> <20170503224626.2818-13-tom@tromey.com>
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