aboutsummaryrefslogtreecommitdiffhomepage
path: root/expand.c
diff options
context:
space:
mode:
Diffstat (limited to 'expand.c')
-rw-r--r--expand.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/expand.c b/expand.c
index 67a6b813..61b31210 100644
--- a/expand.c
+++ b/expand.c
@@ -985,17 +985,16 @@ static int expand_brackets( wchar_t *in, int flags, array_list_t *out )
wchar_t *item_begin;
int len1, len2, tot_len;
-
+
for( pos=in;
- (!bracket_end) && (*pos) && !syntax_error;
+ (*pos) && !syntax_error;
pos++ )
{
switch( *pos )
{
case BRACKET_BEGIN:
{
- if(( bracket_count == 0)&&(bracket_begin==0))
- bracket_begin = pos;
+ bracket_begin = pos;
bracket_count++;
break;
@@ -1004,9 +1003,11 @@ static int expand_brackets( wchar_t *in, int flags, array_list_t *out )
case BRACKET_END:
{
bracket_count--;
- if( (bracket_count == 0) && (bracket_end == 0) )
+ if( bracket_end < bracket_begin )
+ {
bracket_end = pos;
-
+ }
+
if( bracket_count < 0 )
{
syntax_error = 1;
@@ -1024,7 +1025,9 @@ static int expand_brackets( wchar_t *in, int flags, array_list_t *out )
if( bracket_count > 0 )
{
if( !(flags & ACCEPT_INCOMPLETE) )
+ {
syntax_error = 1;
+ }
else
{
@@ -1042,9 +1045,6 @@ static int expand_brackets( wchar_t *in, int flags, array_list_t *out )
sb_append_char( &mod, BRACKET_END );
}
-
-
-
return expand_brackets( (wchar_t*)mod.buff, 1, out );
}
}