Remove set_batch_flag_and_make_cleanup_restore_page_info

This removes set_batch_flag_and_make_cleanup_restore_page_info and
make_cleanup_restore_page_info in favor of a new RAII class.  This
then allows for the removal of make_cleanup_restore_uinteger and
make_cleanup_restore_integer

ChangeLog
2017-10-03  Tom Tromey  <tom@tromey.com>

	* guile/scm-ports.c (ioscm_with_output_to_port_worker): Update.
	* top.c (execute_command_to_string): Update.
	* utils.c (make_cleanup_restore_page_info): Remove.
	(do_restore_page_info_cleanup): Remove.
	(set_batch_flag_and_restore_page_info):
	New.
	(make_cleanup_restore_page_info): Remove.
	(set_batch_flag_and_make_cleanup_restore_page_info): Remove.
	(~set_batch_flag_and_restore_page_info): New
	(make_cleanup_restore_uinteger): Remove.
	(make_cleanup_restore_integer): Remove.
	(struct restore_integer_closure): Remove.
	(restore_integer): Remove.
	* utils.h (struct set_batch_flag_and_restore_page_info): New
	class.
	(set_batch_flag_and_make_cleanup_restore_page_info): Remove.
	(make_cleanup_restore_page_info): Remove.
	(make_cleanup_restore_uinteger) Remove.
	(make_cleanup_restore_integer) Remove.
This commit is contained in:
Tom Tromey
2017-09-29 22:07:37 -06:00
parent 070365117b
commit b95de2b7ae
5 changed files with 58 additions and 85 deletions

View File

@@ -666,11 +666,9 @@ execute_command (char *p, int from_tty)
std::string
execute_command_to_string (char *p, int from_tty)
{
struct cleanup *cleanup;
/* GDB_STDOUT should be better already restored during these
restoration callbacks. */
cleanup = set_batch_flag_and_make_cleanup_restore_page_info ();
set_batch_flag_and_restore_page_info save_page_info;
scoped_restore save_async = make_scoped_restore (&current_ui->async, 0);
@@ -694,8 +692,6 @@ execute_command_to_string (char *p, int from_tty)
execute_command (p, from_tty);
}
do_cleanups (cleanup);
return std::move (str_file.string ());
}