From cd94f6d535d1ebd8f252185cd84d21fe0df3c893 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Fri, 16 Sep 2016 15:44:29 -0400 Subject: Introduce cleanup to restore current_uiout Make a globally available cleanup from a pre-existing one in infrun.c. This is used in a following patch. gdb/ChangeLog: * infrun.c (restore_current_uiout_cleanup): Move to ui-out.c. (print_stop_event): Use make_cleanup_restore_current_uiout. * python/python.c (execute_gdb_command): Likewise. * ui-out.c (restore_current_uiout_cleanup): Move from infrun.c. (make_cleanup_restore_current_uiout): New function definition. * ui-out.h (make_cleanup_restore_current_uiout): New function declaration. * utils.c (do_restore_ui_out): Remove. (make_cleanup_restore_ui_out): Remove. * utils.h (make_cleanup_restore_ui_out): Remove. --- gdb/utils.c | 23 ----------------------- 1 file changed, 23 deletions(-) (limited to 'gdb/utils.c') diff --git a/gdb/utils.c b/gdb/utils.c index 5188828..2afff80 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -338,29 +338,6 @@ struct restore_ui_out_closure struct ui_out *value; }; -static void -do_restore_ui_out (void *p) -{ - struct restore_ui_out_closure *closure - = (struct restore_ui_out_closure *) p; - - *(closure->variable) = closure->value; -} - -/* Remember the current value of *VARIABLE and make it restored when - the cleanup is run. */ - -struct cleanup * -make_cleanup_restore_ui_out (struct ui_out **variable) -{ - struct restore_ui_out_closure *c = XNEW (struct restore_ui_out_closure); - - c->variable = variable; - c->value = *variable; - - return make_cleanup_dtor (do_restore_ui_out, (void *) c, xfree); -} - struct restore_ui_file_closure { struct ui_file **variable; -- cgit v1.1