diff options
author | David Mitchell <davem@iabyn.com> | 2016-12-03 20:58:37 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2016-12-05 11:54:03 +0000 |
commit | b2c9b6ee5d402c923568f214f2e2606287c912d3 (patch) | |
tree | 0c5f13f99d2a2bd4ab5191c94ce68120a0a5e80c /parser.h | |
parent | ddbfb8f680c952529cc9849a6e461bbfeb703526 (diff) | |
download | perl-b2c9b6ee5d402c923568f214f2e2606287c912d3.tar.gz |
yyparse(): only check stack size in outer loop
Rather than checking before each individual shift whether the parse stack
needs extending, only check once per rule, making sure there's enough
space to shift all the items for the longest possible rule
Diffstat (limited to 'parser.h')
-rw-r--r-- | parser.h | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -44,7 +44,9 @@ typedef struct yy_parser { int yylen; /* length of active reduction */ yy_stack_frame *stack; /* base of stack */ - yy_stack_frame *stack_max1;/* (top-1)th element of alloacted stack */ + yy_stack_frame *stack_maxbase;/* (stack + alloced size - YY_MAXRULE) + * it's offset by -YY_MAXRULE to make + * overflow checks quicker */ yy_stack_frame *ps; /* current stack frame */ /* lexer state */ |