]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/ui-out.c
Introduce cleanup to restore current_uiout
[thirdparty/binutils-gdb.git] / gdb / ui-out.c
index 3972a56f9f48eef270dbf3b683ca6bf16b9b4bcb..ec44ab6916a1690c0ce5321552383936d35737e9 100644 (file)
@@ -953,6 +953,24 @@ ui_out_destroy (struct ui_out *uiout)
   xfree (uiout);
 }
 
+/* Cleanup that restores a previous current uiout.  */
+
+static void
+restore_current_uiout_cleanup (void *arg)
+{
+  struct ui_out *saved_uiout = (struct ui_out *) arg;
+
+  current_uiout = saved_uiout;
+}
+
+/* See ui-out.h.  */
+
+struct cleanup *
+make_cleanup_restore_current_uiout (void)
+{
+  return make_cleanup (restore_current_uiout_cleanup, current_uiout);
+}
+
 /* Standard gdb initialization hook.  */
 
 void