diff options
Diffstat (limited to 'toke.c')
-rw-r--r-- | toke.c | 21 |
1 files changed, 11 insertions, 10 deletions
@@ -49,6 +49,8 @@ #define PL_pending_ident (PL_parser->pending_ident) #define PL_preambled (PL_parser->preambled) #define PL_sublex_info (PL_parser->sublex_info) +#define PL_linestr (PL_parser->linestr) + #ifdef PERL_MAD # define PL_endwhite (PL_parser->endwhite) @@ -676,7 +678,6 @@ Perl_lex_start(pTHX_ SV *line) SAVEPPTR(PL_last_lop); SAVEPPTR(PL_last_uni); SAVEPPTR(PL_linestart); - SAVESPTR(PL_linestr); SAVEDESTRUCTOR_X(restore_rsfp, PL_rsfp); SAVEI8(PL_expect); @@ -695,22 +696,20 @@ Perl_lex_start(pTHX_ SV *line) } else { len = 0; } + if (!len) { - PL_linestr = newSVpvs("\n;"); + parser->linestr = newSVpvs("\n;"); } else if (SvREADONLY(line) || s[len-1] != ';') { - PL_linestr = newSVsv(line); + parser->linestr = newSVsv(line); if (s[len-1] != ';') - sv_catpvs(PL_linestr, "\n;"); + sv_catpvs(parser->linestr, "\n;"); } else { SvTEMP_off(line); SvREFCNT_inc_simple_void_NN(line); - PL_linestr = line; + parser->linestr = line; } - /* PL_linestr needs to survive until end of scope, not just the next - FREETMPS. See changes 17505 and 17546 which fixed the symptoms only. */ - SAVEFREESV(PL_linestr); - PL_oldoldbufptr = PL_oldbufptr = PL_bufptr = PL_linestart = SvPVX(PL_linestr); - PL_bufend = PL_bufptr + SvCUR(PL_linestr); + PL_oldoldbufptr = PL_oldbufptr = PL_bufptr = PL_linestart = SvPVX(parser->linestr); + PL_bufend = PL_bufptr + SvCUR(parser->linestr); PL_last_lop = PL_last_uni = NULL; PL_rsfp = 0; } @@ -721,6 +720,8 @@ Perl_lex_start(pTHX_ SV *line) void Perl_parser_free(pTHX_ const yy_parser *parser) { + SvREFCNT_dec(parser->linestr); + Safefree(parser->stack); Safefree(parser->lex_brackstack); Safefree(parser->lex_casestack); |