summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2005-05-26 14:24:31 +0000
committerNicholas Clark <nick@ccl4.org>2005-05-26 14:24:31 +0000
commit7423f6db106ad471398838e82e73b22d8c1e166e (patch)
treeab25b2b670e12e8d4ae54af8c7e216c47ef20c4a /toke.c
parentc4a9c09d5b30a93b6241aff3c9915e33e4e41eeb (diff)
downloadperl-7423f6db106ad471398838e82e73b22d8c1e166e.tar.gz
Store the package name as a shared HEK.
Abolish HvNAME() - as the stored pointer is not a char* you can't set it directly now. Storing a pointer to a HEK tracks the length too, and seems to be faster. p4raw-id: //depot/perl@24584
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/toke.c b/toke.c
index c24c8e4153..432d6cc44a 100644
--- a/toke.c
+++ b/toke.c
@@ -4346,7 +4346,8 @@ Perl_yylex(pTHX)
case KEY___PACKAGE__:
yylval.opval = (OP*)newSVOP(OP_CONST, 0,
(PL_curstash
- ? newSVpv(HvNAME_get(PL_curstash), 0)
+ ? newSVpvn(HvNAME_get(PL_curstash),
+ HvNAMELEN_get(PL_curstash))
: &PL_sv_undef));
TERM(THING);
@@ -5537,7 +5538,8 @@ S_pending_ident(pTHX)
/* might be an "our" variable" */
if (PAD_COMPNAME_FLAGS(tmp) & SVpad_OUR) {
/* build ops for a bareword */
- SV *sym = newSVpv(HvNAME_get(PAD_COMPNAME_OURSTASH(tmp)), 0);
+ SV *sym = newSVpvn(HvNAME_get(PAD_COMPNAME_OURSTASH(tmp)),
+ HvNAMELEN_get(PAD_COMPNAME_OURSTASH(tmp)));
sv_catpvn(sym, "::", 2);
sv_catpv(sym, PL_tokenbuf+1);
yylval.opval = (OP*)newSVOP(OP_CONST, 0, sym);
@@ -9738,7 +9740,8 @@ S_scan_inputsymbol(pTHX_ char *start)
if ((tmp = pad_findmy(d)) != NOT_IN_PAD) {
if (PAD_COMPNAME_FLAGS(tmp) & SVpad_OUR) {
SV *sym = sv_2mortal(
- newSVpv(HvNAME_get(PAD_COMPNAME_OURSTASH(tmp)),0));
+ newSVpvn(HvNAME_get(PAD_COMPNAME_OURSTASH(tmp)),
+ HvNAMELEN_get(PAD_COMPNAME_OURSTASH(tmp))));
sv_catpvn(sym, "::", 2);
sv_catpv(sym, d+1);
d = SvPVX(sym);