[pushed] Remove unnecessary block from execute_fn_to_ui_file

Message ID 20240518165919.3854170-1-tom@tromey.com
State New
Headers
Series [pushed] Remove unnecessary block from execute_fn_to_ui_file |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 fail Patch failed to apply
linaro-tcwg-bot/tcwg_gdb_build--master-arm fail Patch failed to apply

Commit Message

Tom Tromey May 18, 2024, 4:59 p.m. UTC
  I noticed that execute_fn_to_ui_file has an extra, unnecessary block.
This patch removes it.
---
 gdb/top.c | 30 ++++++++++++++----------------
 1 file changed, 14 insertions(+), 16 deletions(-)
  

Comments

Tom Tromey May 18, 2024, 5:02 p.m. UTC | #1
>>>>> "Tom" == Tom Tromey <tom@tromey.com> writes:

Tom> -    scoped_restore save_stdtargerr
Tom> -      = make_scoped_restore (&gdb_stdtargerr, file);

Apparently I forgot to rebase before emailing, because gdb_stdtargerr
doesn't exist any more.  Anyway this is fixed in the actual patch.

Tom
  

Patch

diff --git a/gdb/top.c b/gdb/top.c
index b93ef0a69b5..b5a129f59fc 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -609,22 +609,20 @@  execute_fn_to_ui_file (struct ui_file *file, std::function<void(void)> fn)
 
   scoped_restore save_async = make_scoped_restore (&current_ui->async, 0);
 
-  {
-    ui_out_redirect_pop redirect_popper (current_uiout, file);
-
-    scoped_restore save_stdout
-      = make_scoped_restore (&gdb_stdout, file);
-    scoped_restore save_stderr
-      = make_scoped_restore (&gdb_stderr, file);
-    scoped_restore save_stdlog
-      = make_scoped_restore (&gdb_stdlog, file);
-    scoped_restore save_stdtarg
-      = make_scoped_restore (&gdb_stdtarg, file);
-    scoped_restore save_stdtargerr
-      = make_scoped_restore (&gdb_stdtargerr, file);
-
-    fn ();
-  }
+  ui_out_redirect_pop redirect_popper (current_uiout, file);
+
+  scoped_restore save_stdout
+    = make_scoped_restore (&gdb_stdout, file);
+  scoped_restore save_stderr
+    = make_scoped_restore (&gdb_stderr, file);
+  scoped_restore save_stdlog
+    = make_scoped_restore (&gdb_stdlog, file);
+  scoped_restore save_stdtarg
+    = make_scoped_restore (&gdb_stdtarg, file);
+  scoped_restore save_stdtargerr
+    = make_scoped_restore (&gdb_stdtargerr, file);
+
+  fn ();
 }
 
 /* See top.h.  */