summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-08-30 09:42:05 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-08-30 12:39:39 -0700
commit3638bf155130331f9a06eff9132885b5f244890f (patch)
tree310b34916bca25a292dc0a4565f9d535559c22cc
parent23496c6ea4cd9e3c09a9fe1878f55f241bdc17e5 (diff)
downloadperl-3638bf155130331f9a06eff9132885b5f244890f.tar.gz
Avoid an extra SV when creating $] and $^V
Originally, GVs always had something in the SV slot. So, when the code for $] and $^V started replacing it with another SV, it had to free the existing SV. Then commit c69033f2 came along and added the PERL_DONT_CREATE_GVSV directive. It necessarily changed a bunch of GvSV()s to GvSVn()s in gv_fetchpvn_flags. But it changed these two, even though they didn’t need it. So, when PERL_DONT_CREATE_GVSV is true (the default), we just create and throw away a scalar needlessly.
-rw-r--r--gv.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gv.c b/gv.c
index d2d2ed2dde..e4c1d211f7 100644
--- a/gv.c
+++ b/gv.c
@@ -1685,7 +1685,7 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags,
break;
case ']': /* $] */
{
- SV * const sv = GvSVn(gv);
+ SV * const sv = GvSV(gv);
if (!sv_derived_from(PL_patchlevel, "version"))
upg_version(PL_patchlevel, TRUE);
GvSV(gv) = vnumify(PL_patchlevel);
@@ -1695,7 +1695,7 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags,
break;
case '\026': /* $^V */
{
- SV * const sv = GvSVn(gv);
+ SV * const sv = GvSV(gv);
GvSV(gv) = new_version(PL_patchlevel);
SvREADONLY_on(GvSV(gv));
SvREFCNT_dec(sv);