aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar axel <axel@liljencrantz.se>2005-09-27 00:58:35 +1000
committerGravatar axel <axel@liljencrantz.se>2005-09-27 00:58:35 +1000
commit6d4e6f40ce5896bb80404e8db7042c9af588cd20 (patch)
treef616336c0b56a06fb47489bdc1f64c7841d3d58c
parent0a87af38f918f09d354cec3940cb97c248253e21 (diff)
For-loop variable must have explicitly local scope
darcs-hash:20050926145835-ac50b-828ed718f1b4a4fdb949c597ce6a0b008926c11e.gz
-rw-r--r--ChangeLog3
-rw-r--r--builtin.c4
2 files changed, 5 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 1b25f08f..7f1fe922 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,9 @@
* env.c, builtin_set.c (env_exist, env_get, env_set, builtin_set): Add support for zero element arrays
* env.c (env_set): Default scope for variables is innermost function block
+
+ * builtin.c (builtin_for): For-loop variable must have explicitly local scope
+
2005-09-25 Axel Liljencrantz <axel@liljencrantz.se>
diff --git a/builtin.c b/builtin.c
index e82ac845..b5a7f0b4 100644
--- a/builtin.c
+++ b/builtin.c
@@ -2281,7 +2281,7 @@ static int builtin_for( wchar_t **argv )
}
if( argc > 3 )
{
- env_set( current_block->for_variable, argv[3], 0);
+ env_set( current_block->for_variable, argv[3], ENV_LOCAL );
}
else
{
@@ -2371,7 +2371,7 @@ static int builtin_end( wchar_t **argv )
if( al_get_count( &current_block->for_vars ) )
{
wchar_t *val = (wchar_t *)al_pop( &current_block->for_vars );
- env_set( current_block->for_variable, val, 0);
+ env_set( current_block->for_variable, val, ENV_LOCAL);
current_block->loop_status = LOOP_NORMAL;
current_block->skip = 0;
free(val);