develooper Front page | perl.perl5.changes | Postings from November 2010

[perl.git] branch blead, updated. v5.13.7-91-ga317968

From:
Nicholas Clark
Date:
November 25, 2010 05:58
Subject:
[perl.git] branch blead, updated. v5.13.7-91-ga317968
Message ID:
E1PLcLD-00012W-1a@camel.ams6.corp.booking.com
In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/a3179684398978e8bf4afba360eb728e4215d751?hp=2456140e9cfda88ed22ea1c7290a61234c84aea6>

- Log -----------------------------------------------------------------
commit a3179684398978e8bf4afba360eb728e4215d751
Author: Nicholas Clark <nick@ccl4.org>
Date:   Thu Nov 25 13:53:28 2010 +0000

    Use newSVpvs_flags() instead of sv_2mortal(newSVpvs())
    
    And similarly for newSVpvn() for a known length.
-----------------------------------------------------------------------

Summary of changes:
 hv.c             |    2 +-
 mro.c            |    2 +-
 pod/perlguts.pod |    2 ++
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/hv.c b/hv.c
index 18411d6..a9fedb4 100644
--- a/hv.c
+++ b/hv.c
@@ -3428,7 +3428,7 @@ Perl_store_cop_label(pTHX_ COP *const cop, const char *label, STRLEN len,
     if (flags & ~(SVf_UTF8))
 	Perl_croak(aTHX_ "panic: store_cop_label illegal flag bits 0x%" UVxf,
 		   (UV)flags);
-    labelsv = sv_2mortal(newSVpvn(label, len));
+    labelsv = newSVpvn_flags(label, len, SVs_TEMP);
     if (flags & SVf_UTF8)
 	SvUTF8_on(labelsv);
     cop->cop_hints_hash
diff --git a/mro.c b/mro.c
index fd805d6..a5f1de0 100644
--- a/mro.c
+++ b/mro.c
@@ -752,7 +752,7 @@ Perl_mro_package_moved(pTHX_ HV * const stash, HV * const oldstash,
     }
     if (name_count == 1) {
 	if (HEK_LEN(*namep) == 4 && strnEQ(HEK_KEY(*namep), "main", 4)) {
-	    namesv = sv_2mortal(newSVpvs(""));
+	    namesv = newSVpvs_flags("", SVs_TEMP);
 	}
 	else {
 	    namesv = sv_2mortal(newSVhek(*namep));
diff --git a/pod/perlguts.pod b/pod/perlguts.pod
index 00df255..8327db2 100644
--- a/pod/perlguts.pod
+++ b/pod/perlguts.pod
@@ -1450,6 +1450,8 @@ L</Reference Counts and Mortality>):
     PUSHs(sv_2mortal(newSVuv(an_unsigned_integer)))
     PUSHs(sv_2mortal(newSVnv(a_double)))
     PUSHs(sv_2mortal(newSVpv("Some String",0)))
+    /* Although the last example is better written as the more efficient: */
+    PUSHs(newSVpvs_flags("Some String", SVs_TEMP))
 
 And now the Perl program calling C<tzname>, the two values will be assigned
 as in:

--
Perl5 Master Repository



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About