aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@ericsson.com>2017-09-16 13:45:56 +0200
committerSimon Marchi <simon.marchi@ericsson.com>2017-09-16 13:45:56 +0200
commit5846367a24e24f334077ceb7f7389acbd072b11a (patch)
tree854f0bf70feb00e461b427953085c3b037158974 /gdb
parentbd77e8ff276864d6622f2433b8a499bf4332fa65 (diff)
downloadgdb-5846367a24e24f334077ceb7f7389acbd072b11a.zip
gdb-5846367a24e24f334077ceb7f7389acbd072b11a.tar.gz
gdb-5846367a24e24f334077ceb7f7389acbd072b11a.tar.bz2
mi_load_progress: Restore current_uiout using a scoped_restore
Simply use a scoped_restore instead of manually saving and restoring current_uiout. gdb/ChangeLog: * mi/mi-main.c (mi_load_progress): Restore current_uiout using a scoped_restore.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/mi/mi-main.c7
2 files changed, 7 insertions, 5 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a7a87ee..9ee44fb 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2017-09-16 Simon Marchi <simon.marchi@ericsson.com>
+ * mi/mi-main.c (mi_load_progress): Restore current_uiout using a
+ scoped_restore.
+
+2017-09-16 Simon Marchi <simon.marchi@ericsson.com>
+
* mi/mi-main.c (mi_load_progress): Make uiout variable
a unique_ptr.
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 0359dc1..c06ef18 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -2324,13 +2324,11 @@ mi_load_progress (const char *section_name,
static steady_clock::time_point last_update;
static char *previous_sect_name = NULL;
int new_section;
- struct ui_out *saved_uiout;
struct mi_interp *mi = (struct mi_interp *) current_interpreter ();
/* This function is called through deprecated_show_load_progress
which means uiout may not be correct. Fix it for the duration
of this function. */
- saved_uiout = current_uiout;
std::unique_ptr<ui_out> uiout;
@@ -2344,7 +2342,8 @@ mi_load_progress (const char *section_name,
else
return;
- current_uiout = uiout.get ();
+ scoped_restore save_uiout
+ = make_scoped_restore (&current_uiout, uiout.get ());
new_section = (previous_sect_name ?
strcmp (previous_sect_name, section_name) : 1);
@@ -2386,8 +2385,6 @@ mi_load_progress (const char *section_name,
fputs_unfiltered ("\n", mi->raw_stdout);
gdb_flush (mi->raw_stdout);
}
-
- current_uiout = saved_uiout;
}
static void