summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2014-09-03 12:59:15 -0700
committerFather Chrysostomos <sprout@cpan.org>2014-09-03 19:07:53 -0700
commite5debd1111585b5c96f1f1b3d271e88e0ab68134 (patch)
tree5e4b0f05050aadfe3344019d3f3900ca66e7bb5a /toke.c
parente093953796c2b52df4a70fb9d48a4cad66bc6cc1 (diff)
downloadperl-e5debd1111585b5c96f1f1b3d271e88e0ab68134.tar.gz
toke.c: Stop using len to indicate trailing ::
This variable stores the length of the word we are parsing. But at one point it starts being used as a boolean to indicate that we have a bareword ending in two colons. So if are looking up are bareword that does not end in ::, we have to call strlen() to scan the string and determine the length.
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/toke.c b/toke.c
index e5e3ddf074..6303103ef3 100644
--- a/toke.c
+++ b/toke.c
@@ -6477,6 +6477,7 @@ Perl_yylex(pTHX)
lastchar && PL_bufptr - 2 >= PL_linestart
? PL_bufptr[-2]
: 0;
+ bool safebw;
/* Get the rest if it looks like a package qualifier */
@@ -6520,6 +6521,7 @@ Perl_yylex(pTHX)
PL_tokenbuf[len] = '\0';
gv = NULL;
gvp = 0;
+ safebw = TRUE;
}
else {
if (!lex && !gv) {
@@ -6531,14 +6533,14 @@ Perl_yylex(pTHX)
GV_NOADD_NOINIT | ( UTF ? SVf_UTF8 : 0 ),
SVt_PVCV);
}
- len = 0;
+ safebw = FALSE;
}
/* if we saw a global override before, get the right name */
if (!sv)
sv = S_newSV_maybe_utf8(aTHX_ PL_tokenbuf,
- len ? len : strlen(PL_tokenbuf));
+ len);
if (gvp) {
SV * const tmp_sv = sv;
sv = newSVpvs("CORE::GLOBAL::");
@@ -6553,7 +6555,7 @@ Perl_yylex(pTHX)
pl_yylval.opval->op_private = OPpCONST_BARE;
/* And if "Foo::", then that's what it certainly is. */
- if (len)
+ if (safebw)
goto safe_bareword;
if (!off)