Introduce make_cleanup_restore_current_ui
authorPedro Alves <palves@redhat.com>
Tue, 6 Sep 2016 22:17:14 +0000 (23:17 +0100)
committerPedro Alves <palves@redhat.com>
Tue, 6 Sep 2016 22:17:14 +0000 (23:17 +0100)
Just a tidy, no functional changes.

gdb/ChangeLog:
2016-09-06  Pedro Alves  <palves@redhat.com>

* event-top.c (restore_ui_cleanup): Now static.
(make_cleanup_restore_current_ui): New function.
(switch_thru_all_uis_init): Use it.
* infcall.c (call_thread_fsm_should_stop): Use it.
* infrun.c (fetch_inferior_event): Use it.
* top.c (new_ui_command): Use it.
* top.h (restore_ui_cleanup): Delete declaration.
(make_cleanup_restore_current_ui): New declaration.

gdb/ChangeLog
gdb/event-top.c
gdb/infcall.c
gdb/infrun.c
gdb/top.c
gdb/top.h

index 0df148676cb8119d712f486ea5e22b66865db6be..e5e0cb51001ba3d4bbe1e7f31796be5742f04189 100644 (file)
@@ -1,3 +1,14 @@
+2016-09-06  Pedro Alves  <palves@redhat.com>
+
+       * event-top.c (restore_ui_cleanup): Now static.
+       (make_cleanup_restore_current_ui): New function.
+       (switch_thru_all_uis_init): Use it.
+       * infcall.c (call_thread_fsm_should_stop): Use it.
+       * infrun.c (fetch_inferior_event): Use it.
+       * top.c (new_ui_command): Use it.
+       * top.h (restore_ui_cleanup): Delete declaration.
+       (make_cleanup_restore_current_ui): New declaration.
+
 2016-09-05  Ulrich Weigand  <uweigand@de.ibm.com>
 
        * i386-tdep.c (i386_floatformat_for_type): New function.
index 91b06e6e1f6078b10eb899f517af1aeaa9e0f6be..576eded22c25cad4e1561de35182c05c41e8d685 100644 (file)
@@ -447,9 +447,9 @@ struct ui *main_ui;
 struct ui *current_ui;
 struct ui *ui_list;
 
-/* See top.h.  */
+/* A cleanup handler that restores the current UI.  */
 
-void
+static void
 restore_ui_cleanup (void *data)
 {
   current_ui = (struct ui *) data;
@@ -457,11 +457,19 @@ restore_ui_cleanup (void *data)
 
 /* See top.h.  */
 
+struct cleanup *
+make_cleanup_restore_current_ui (void)
+{
+  return make_cleanup (restore_ui_cleanup, current_ui);
+}
+
+/* See top.h.  */
+
 void
 switch_thru_all_uis_init (struct switch_thru_all_uis *state)
 {
   state->iter = ui_list;
-  state->old_chain = make_cleanup (restore_ui_cleanup, current_ui);
+  state->old_chain = make_cleanup_restore_current_ui ();
 }
 
 /* See top.h.  */
index 8595d9e05853988544501f0d1f7f8caca6f7e320..3c33c11d6a335e6d3a4f46e311690b69ea57dcfb 100644 (file)
@@ -530,7 +530,7 @@ call_thread_fsm_should_stop (struct thread_fsm *self,
       f->return_value = get_call_return_value (&f->return_meta_info);
 
       /* Break out of wait_sync_command_done.  */
-      old_chain = make_cleanup (restore_ui_cleanup, current_ui);
+      old_chain = make_cleanup_restore_current_ui ();
       current_ui = f->waiting_ui;
       target_terminal_ours ();
       f->waiting_ui->prompt_state = PROMPT_NEEDED;
index 90841f4e55f4ebb4f1ed9112d726d223abce8013..70d7a095cfdacbf77403df44f009d665f4ed4aca 100644 (file)
@@ -3915,7 +3915,7 @@ fetch_inferior_event (void *client_data)
   /* Events are always processed with the main UI as current UI.  This
      way, warnings, debug output, etc. are always consistently sent to
      the main console.  */
-  make_cleanup (restore_ui_cleanup, current_ui);
+  make_cleanup_restore_current_ui ();
   current_ui = main_ui;
 
   /* End up with readline processing input, if necessary.  */
index bc44192b8ad52dbb025bbd4bb624f08cb7345b38..5b385d2709e17dad005a5099efac23c7b824de87 100644 (file)
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -386,7 +386,7 @@ new_ui_command (char *args, int from_tty)
   interpreter_name = argv[0];
   tty_name = argv[1];
 
-  make_cleanup (restore_ui_cleanup, current_ui);
+  make_cleanup_restore_current_ui ();
 
   failure_chain = make_cleanup (null_cleanup, NULL);
 
index c5f6bc7b45b947a1b7afa67a8818689f59e78b52..ee664c1c38993b4d85e811f29f104f53ebd451e6 100644 (file)
--- a/gdb/top.h
+++ b/gdb/top.h
@@ -188,8 +188,8 @@ extern void delete_ui (struct ui *todel);
 /* Cleanup that deletes a UI.  */
 extern struct cleanup *make_delete_ui_cleanup (struct ui *ui);
 
-/* Cleanup that restores the current UI.  */
-extern void restore_ui_cleanup (void *data);
+/* Make a cleanup that restores the current UI.  */
+extern struct cleanup *make_cleanup_restore_current_ui (void);
 
 /* Register the UI's input file descriptor in the event loop.  */
 extern void ui_register_input_event_handler (struct ui *ui);
This page took 0.039179 seconds and 4 git commands to generate.