Merged revisions 177225 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r177225 | murf | 2009-02-18 15:43:14 -0700 (Wed, 18 Feb 2009) | 34 lines
  
  This patch fixes a regression of sorts that was introduced in 
  rev 24425.
  
  It basically fixes AST-190/ABE-1782.
  
  What was wrong: the user has 6000 extensions in one context; and
  then 6000 contexts, one per extension. The parser could only handle
  about 4893 of the 6000 extens in the single context.
  
  This was due to the regression I mentioned. To get rid of
  shift/reduce conflicts, Luigi set up right-recursive lists
  for globals, context elements, switch lists, and statements.
  Right recursive lists got rid of the warnings, but instead, they
  use up a tremendous amount of stack space when the lists are long.
  
  I saw this a few years back, and resolved not to fix it until
  someone complained. That day has arrived!
  
  After the changes were made, I ran the regression test suite,
  and there were no problems.
  
  I took the test case the user provided, and added 100,000 
  extensions to the single context, that already had 6,000 extens
  in it. (I'll see your 6, and raise you 100!) It takes a few minutes
  to read it all in, check it and generate code for it, but no
  problems.
  
  So, I think I can say that fundamentally, there are no longer
  any limits on the number of items you can place in contexts,
  statement blocks, switches, or globals, beyond your virt mem
  constraints.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@177286 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Steve Murphy
2009-02-18 23:50:57 +00:00
parent b2d959c7fa
commit 6c2a537c5f
2 changed files with 238 additions and 228 deletions

View File

@@ -159,7 +159,7 @@ static pval *update_last(pval *, YYLTYPE *);
/* there will be two shift/reduce conflicts, they involve the if statement, where a single statement occurs not wrapped in curlies in the "true" section
the default action to shift will attach the else to the preceeding if. */
%expect 3
%expect 30
%error-verbose
/*
@@ -235,7 +235,7 @@ globals : KW_GLOBALS LC global_statements RC {
;
global_statements : { $$ = NULL; }
| assignment global_statements {$$ = linku1($1, $2); }
| global_statements assignment {$$ = linku1($1, $2); }
| error global_statements {$$=$2;}
;
@@ -259,7 +259,7 @@ arglist : /* empty */ { $$ = NULL; }
;
elements : {$$=0;}
| element elements { $$ = linku1($1, $2); }
| elements element { $$ = linku1($1, $2); }
| error elements { $$=$2;}
;
@@ -311,7 +311,7 @@ extension : word EXTENMARK statement {
/* list of statements in a block or after a case label - can be empty */
statements : /* empty */ { $$ = NULL; }
| statement statements { $$ = linku1($1, $2); }
| statements statement { $$ = linku1($1, $2); }
| error statements {$$=$2;}
;
@@ -622,7 +622,7 @@ eval_arglist : word_list { $$ = nword($1, &@1); }
;
case_statements: /* empty */ { $$ = NULL; }
| case_statement case_statements { $$ = linku1($1, $2); }
| case_statements case_statement { $$ = linku1($1, $2); }
;
case_statement: KW_CASE word COLON statements {
@@ -640,7 +640,7 @@ case_statement: KW_CASE word COLON statements {
;
macro_statements: /* empty */ { $$ = NULL; }
| macro_statement macro_statements { $$ = linku1($1, $2); }
| macro_statements macro_statement { $$ = linku1($1, $2); }
;
macro_statement : statement {$$=$1;}
@@ -662,16 +662,16 @@ eswitches : KW_ESWITCHES LC switchlist RC {
;
switchlist : /* empty */ { $$ = NULL; }
| word SEMI switchlist { $$ = linku1(nword($1, &@1), $3); }
| word AT word SEMI switchlist {
| switchlist word SEMI { $$ = linku1($1,nword($2, &@2)); }
| switchlist word AT word SEMI {
char *x;
if (asprintf(&x,"%s@%s", $1, $3) < 0) {
if (asprintf(&x,"%s@%s", $2, $4) < 0) {
ast_log(LOG_WARNING, "asprintf() failed\n");
$$ = NULL;
} else {
free($1);
free($3);
$$ = linku1(nword(x, &@1), $5);
free($2);
free($4);
$$ = linku1($1,nword(x, &@2));
}
}
| error switchlist {$$=$2;}