From 9657ccb4f31f4d026ef8ff65d8cfb5c24d0949ef Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Sat, 22 Jun 2013 12:09:07 -0700 Subject: [PATCH] =?utf8?q?toke.c:=20Don=E2=80=99t=20depend=20on=20sv=5Ffor?= =?utf8?q?ce=5Fnormal=E2=80=99s=20good=20graces?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit when parsing ‘keyword =>’ with comments or line breaks before the =>. sv_force_normal will allow modification of read-only values at compile time. While this might be convenient, it has resulted in many bugs elsewhere, so I am trying to change that. This is a necessary pre- requisite. --- toke.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/toke.c b/toke.c index 0a16715..e31275d 100644 --- a/toke.c +++ b/toke.c @@ -7182,9 +7182,13 @@ Perl_yylex(pTHX) if (*s == '=' && s[1] == '>' && !pkgname) { op_free(rv2cv_op); CLINE; + /* This is our own scalar, created a few lines above, + so this is safe. */ + SvREADONLY_off(cSVOPx(pl_yylval.opval)->op_sv); sv_setpv(((SVOP*)pl_yylval.opval)->op_sv, PL_tokenbuf); if (UTF && !IN_BYTES && is_utf8_string((U8*)PL_tokenbuf, len)) SvUTF8_on(((SVOP*)pl_yylval.opval)->op_sv); + SvREADONLY_on(cSVOPx(pl_yylval.opval)->op_sv); TERM(WORD); } -- 2.7.4