diff options
author | Tom Tromey <tromey@redhat.com> | 2013-05-30 16:25:49 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2013-05-30 16:25:49 +0000 |
commit | 8b50a13a31f4ef572b16144fe832bcd2fd08ece7 (patch) | |
tree | 4d50d0d65bc027441b444265f159c081d547c7ca | |
parent | fcf3be2b715c1defb0e199ac01be903d301372a8 (diff) | |
download | gdb-8b50a13a31f4ef572b16144fe832bcd2fd08ece7.tar.gz |
fix print_command_1
This is a stylistic patch to make it so the checker can analyze
print_command_1. This amounts to installing an outer cleanup and
unconditionally invoking it.
* printcmd.c (print_command_1): Unconditionally call do_cleanups.
-rw-r--r-- | gdb/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/printcmd.c | 9 |
2 files changed, 7 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e608b0a8579..86c63690db2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ 2013-05-30 Tom Tromey <tromey@redhat.com> + * printcmd.c (print_command_1): Unconditionally call do_cleanups. + +2013-05-30 Tom Tromey <tromey@redhat.com> + * cli/cli-cmds.c (cd_command, alias_command): Call do_cleanups. * cli/cli-dump.c (restore_binary_file): Call do_cleanups. * interps.c (interpreter_exec_cmd): Call do_cleanups. diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 2cc33d04dfe..7beb334c5e2 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -936,11 +936,10 @@ static void print_command_1 (const char *exp, int voidprint) { struct expression *expr; - struct cleanup *old_chain = 0; + struct cleanup *old_chain = make_cleanup (null_cleanup, NULL); char format = 0; struct value *val; struct format_data fmt; - int cleanup = 0; if (exp && *exp == '/') { @@ -960,8 +959,7 @@ print_command_1 (const char *exp, int voidprint) if (exp && *exp) { expr = parse_expression (exp); - old_chain = make_cleanup (free_current_contents, &expr); - cleanup = 1; + make_cleanup (free_current_contents, &expr); val = evaluate_expression (expr); } else @@ -996,8 +994,7 @@ print_command_1 (const char *exp, int voidprint) annotate_value_end (); } - if (cleanup) - do_cleanups (old_chain); + do_cleanups (old_chain); } static void |