diff options
author | Tom Tromey <tromey@redhat.com> | 2013-05-30 17:13:19 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2013-05-30 17:13:19 +0000 |
commit | e12fefc804bcbe2d53554390b76f07005632a526 (patch) | |
tree | 094e10dc9c60d6b54cc1df006e14d206d3aad2dc /gdb/cli | |
parent | 4867f990df59cbde08a2e09471f1ca7c1404a14b (diff) | |
download | gdb-e12fefc804bcbe2d53554390b76f07005632a526.zip gdb-e12fefc804bcbe2d53554390b76f07005632a526.tar.gz gdb-e12fefc804bcbe2d53554390b76f07005632a526.tar.bz2 |
simplify cli-logging.c for analysis
This is another stylistic patch. It changes cli-logging.c to be
analyzable by the checker, again following the method of adding an
outer cleanup and unconditionally calling do_cleanups.
* cli/cli-logging.c (set_logging_redirect): Unconditionally
call do_cleanups.
Diffstat (limited to 'gdb/cli')
-rw-r--r-- | gdb/cli/cli-logging.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/gdb/cli/cli-logging.c b/gdb/cli/cli-logging.c index 9f1477d..5704179 100644 --- a/gdb/cli/cli-logging.c +++ b/gdb/cli/cli-logging.c @@ -79,7 +79,7 @@ static struct ui_file *logging_no_redirect_file; static void set_logging_redirect (char *args, int from_tty, struct cmd_list_element *c) { - struct cleanup *cleanups = NULL; + struct cleanup *cleanups; struct ui_file *output, *new_logging_no_redirect_file; struct ui_out *uiout = current_uiout; @@ -88,13 +88,15 @@ set_logging_redirect (char *args, int from_tty, struct cmd_list_element *c) || (logging_redirect == 0 && logging_no_redirect_file != NULL)) return; + cleanups = make_cleanup (null_cleanup, NULL); + if (logging_redirect != 0) { gdb_assert (logging_no_redirect_file != NULL); /* ui_out_redirect still has not been called for next gdb_stdout. */ - cleanups = make_cleanup_ui_file_delete (gdb_stdout); + make_cleanup_ui_file_delete (gdb_stdout); output = logging_no_redirect_file; new_logging_no_redirect_file = NULL; @@ -139,8 +141,7 @@ set_logging_redirect (char *args, int from_tty, struct cmd_list_element *c) || ui_out_redirect (uiout, output) < 0) warning (_("Current output protocol does not support redirection")); - if (logging_redirect != 0) - do_cleanups (cleanups); + do_cleanups (cleanups); } static void |