This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Code cleanup: Move print_command_1 expr variable scope
- From: Jan Kratochvil <jkratoch at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 26 Mar 2015 17:45:51 -0000
- Subject: [binutils-gdb] Code cleanup: Move print_command_1 expr variable scope
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f30d5c78faa5979fb933038923e5270b7728f96f
commit f30d5c78faa5979fb933038923e5270b7728f96f
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Thu Mar 26 18:44:38 2015 +0100
Code cleanup: Move print_command_1 expr variable scope
gdb/ChangeLog
2015-03-26 Jan Kratochvil <jan.kratochvil@redhat.com>
Code cleanup.
* printcmd.c (print_command_1): Move expr variable scope.
Diff:
---
gdb/ChangeLog | 5 +++++
gdb/printcmd.c | 3 ++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 55a8383..94ef5c8 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,6 +1,11 @@
2015-03-26 Jan Kratochvil <jan.kratochvil@redhat.com>
Code cleanup.
+ * printcmd.c (print_command_1): Move expr variable scope.
+
+2015-03-26 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Code cleanup.
* printcmd.c (validate_format): Make the parameter cmdname const.
2015-03-26 Don Breazeal <donb@codesourcery.com>
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index deb501a..a1451f8 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -946,7 +946,6 @@ validate_format (struct format_data fmt, const char *cmdname)
static void
print_command_1 (const char *exp, int voidprint)
{
- struct expression *expr;
struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);
char format = 0;
struct value *val;
@@ -969,6 +968,8 @@ print_command_1 (const char *exp, int voidprint)
if (exp && *exp)
{
+ struct expression *expr;
+
expr = parse_expression (exp);
make_cleanup (free_current_contents, &expr);
val = evaluate_expression (expr);