summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2007-01-03 22:17:48 +0000
committerDave Mitchell <davem@fdisolutions.com>2007-01-03 22:17:48 +0000
commit7c197c94dc644853d0512a443fd0e99a5f287ad0 (patch)
tree1ba6b14de8f6cd9ad2c4814d1c35f491e4b74cad /sv.c
parent0e4c4423f4f1412e4eeb73b8af7f846ea7b0c4bc (diff)
downloadperl-7c197c94dc644853d0512a443fd0e99a5f287ad0.tar.gz
handle cloning of parsers on the save stack
p4raw-id: //depot/perl@29678
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sv.c b/sv.c
index 8bed94185d..15f54d85ce 100644
--- a/sv.c
+++ b/sv.c
@@ -9498,7 +9498,14 @@ Perl_parser_dup(pTHX_ const yy_parser *proto, CLONE_PARAMS* param)
if (!proto)
return NULL;
+ /* look for it in the table first */
+ parser = (yy_parser *)ptr_table_fetch(PL_ptr_table, proto);
+ if (parser)
+ return parser;
+
+ /* create anew and remember what it is */
Newxz(parser, 1, yy_parser);
+ ptr_table_store(PL_ptr_table, proto, parser);
parser->yyerrstatus = 0;
parser->yychar = YYEMPTY; /* Cause a token to be read. */
@@ -10670,6 +10677,10 @@ Perl_ss_dup(pTHX_ PerlInterpreter *proto_perl, CLONE_PARAMS* param)
ptr = POPPTR(ss,ix);
TOPPTR(nss,ix) = DUP_WARNINGS((STRLEN*)ptr);
break;
+ case SAVEt_PARSER:
+ ptr = POPPTR(ss,ix);
+ TOPPTR(nss,ix) = parser_dup(ptr, param);
+ break;
default:
Perl_croak(aTHX_
"panic: ss_dup inconsistency (%"IVdf")", (IV) type);