summaryrefslogtreecommitdiff
path: root/parser.h
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2016-12-03 20:58:37 +0000
committerDavid Mitchell <davem@iabyn.com>2016-12-05 11:54:03 +0000
commitb2c9b6ee5d402c923568f214f2e2606287c912d3 (patch)
tree0c5f13f99d2a2bd4ab5191c94ce68120a0a5e80c /parser.h
parentddbfb8f680c952529cc9849a6e461bbfeb703526 (diff)
downloadperl-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.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/parser.h b/parser.h
index c5a59abc5d..3c7bb4e97d 100644
--- a/parser.h
+++ b/parser.h
@@ -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 */