[git commit] hush: push down expansion var in handle_dollar()

Mike Frysinger vapier at gentoo.org
Mon Jun 1 18:13:39 UTC 2009


commit: http://git.busybox.net/busybox/commit/?id=ef3e7fdd3b18ef3c43a58a06251eaf615e18a789
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master


Declare the variable in the scope it is used rather than the entire
function scope so it's obvious it is only used there.

Signed-off-by: Mike Frysinger <vapier at gentoo.org>
---
 shell/hush.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/shell/hush.c b/shell/hush.c
index b5cf861..4c45e65 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -5240,7 +5240,6 @@ static int handle_dollar(o_string *as_string,
 		o_string *dest,
 		struct in_str *input)
 {
-	int expansion;
 	int ch = i_peek(input);  /* first character after the $ */
 	unsigned char quote_mask = dest->o_escape ? 0x80 : 0;
 
@@ -5279,10 +5278,12 @@ static int handle_dollar(o_string *as_string,
 		goto make_one_char_var;
 	case '{': {
 		bool first_char, all_digits;
+		int expansion;
 
-		o_addchr(dest, SPECIAL_VAR_SYMBOL);
 		ch = i_getch(input);
 		nommu_addchr(as_string, ch);
+		o_addchr(dest, SPECIAL_VAR_SYMBOL);
+
 		/* TODO: maybe someone will try to escape the '}' */
 		expansion = 0;
 		first_char = true;
-- 
1.6.0.6


More information about the busybox-cvs mailing list