summaryrefslogtreecommitdiff
path: root/ext/pdo_sqlite/sqlite/tool/lempar.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2005-08-28 16:57:01 +0000
committerIlia Alshanetsky <iliaa@php.net>2005-08-28 16:57:01 +0000
commitbb3801714270de37f05383214aadfb09006113ea (patch)
tree2549f7b9f0563bb3e88cc95f80ce1692d3e89f69 /ext/pdo_sqlite/sqlite/tool/lempar.c
parent4509fb9d5d9bc423e34f6a944191b6309e9d0b74 (diff)
downloadphp-git-bb3801714270de37f05383214aadfb09006113ea.tar.gz
Upgrade sqlite lib to 3.2.5
Diffstat (limited to 'ext/pdo_sqlite/sqlite/tool/lempar.c')
-rw-r--r--ext/pdo_sqlite/sqlite/tool/lempar.c37
1 files changed, 32 insertions, 5 deletions
diff --git a/ext/pdo_sqlite/sqlite/tool/lempar.c b/ext/pdo_sqlite/sqlite/tool/lempar.c
index aac842f10c..57ec97f6a8 100644
--- a/ext/pdo_sqlite/sqlite/tool/lempar.c
+++ b/ext/pdo_sqlite/sqlite/tool/lempar.c
@@ -364,11 +364,11 @@ static int yy_find_shift_action(
** return YY_NO_ACTION.
*/
static int yy_find_reduce_action(
- yyParser *pParser, /* The parser */
+ int stateno, /* Current state number */
int iLookAhead /* The look-ahead token */
){
int i;
- int stateno = pParser->yystack[pParser->yyidx].stateno;
+ /* int stateno = pParser->yystack[pParser->yyidx].stateno; */
i = yy_reduce_ofst[stateno];
if( i==YY_REDUCE_USE_DFLT ){
@@ -462,6 +462,18 @@ static void yy_reduce(
}
#endif /* NDEBUG */
+#ifndef NDEBUG
+ /* Silence complaints from purify about yygotominor being uninitialized
+ ** in some cases when it is copied into the stack after the following
+ ** switch. yygotominor is uninitialized when a rule reduces that does
+ ** not set the value of its left-hand side nonterminal. Leaving the
+ ** value of the nonterminal uninitialized is utterly harmless as long
+ ** as the value is never used. So really the only thing this code
+ ** accomplishes is to quieten purify.
+ */
+ memset(&yygotominor, 0, sizeof(yygotominor));
+#endif
+
switch( yyruleno ){
/* Beginning here are the reduction cases. A typical example
** follows:
@@ -476,9 +488,24 @@ static void yy_reduce(
yygoto = yyRuleInfo[yyruleno].lhs;
yysize = yyRuleInfo[yyruleno].nrhs;
yypParser->yyidx -= yysize;
- yyact = yy_find_reduce_action(yypParser,yygoto);
+ yyact = yy_find_reduce_action(yymsp[-yysize].stateno,yygoto);
if( yyact < YYNSTATE ){
- yy_shift(yypParser,yyact,yygoto,&yygotominor);
+#ifdef NDEBUG
+ /* If we are not debugging and the reduce action popped at least
+ ** one element off the stack, then we can push the new element back
+ ** onto the stack here, and skip the stack overflow test in yy_shift().
+ ** That gives a significant speed improvement. */
+ if( yysize ){
+ yypParser->yyidx++;
+ yymsp -= yysize-1;
+ yymsp->stateno = yyact;
+ yymsp->major = yygoto;
+ yymsp->minor = yygotominor;
+ }else
+#endif
+ {
+ yy_shift(yypParser,yyact,yygoto,&yygotominor);
+ }
}else if( yyact == YYNSTATE + YYNRULE + 1 ){
yy_accept(yypParser);
}
@@ -570,7 +597,7 @@ void Parse(
/* (re)initialize the parser, if necessary */
yypParser = (yyParser*)yyp;
if( yypParser->yyidx<0 ){
- if( yymajor==0 ) return;
+ /* if( yymajor==0 ) return; // not sure why this was here... */
yypParser->yyidx = 0;
yypParser->yyerrcnt = -1;
yypParser->yystack[0].stateno = 0;