From 3638bf155130331f9a06eff9132885b5f244890f Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Tue, 30 Aug 2011 09:42:05 -0700 Subject: Avoid an extra SV when creating $] and $^V MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- gv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gv.c') 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); -- cgit v1.2.1