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.
This commit is contained in:
Tom Tromey 2013-05-30 16:25:49 +00:00
parent 5b3fca71ae
commit 27833de78f
2 changed files with 7 additions and 6 deletions

View File

@ -1,3 +1,7 @@
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.

View File

@ -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