In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/a14be3eb83c92f38596c3a429d631615e84e660b?hp=4f738c750ddb40ef82b46158f89572739a8b186a>

- Log -----------------------------------------------------------------
commit a14be3eb83c92f38596c3a429d631615e84e660b
Author: Yves Orton <[email protected]>
Date:   Sat Nov 26 20:12:41 2016 +0100

    make sure that new heredoc parsing doesn't COW during prefix strip

M       toke.c

commit acbcf0c557760e0c5727e428d68ca54baaf2e894
Author: Yves Orton <[email protected]>
Date:   Fri Nov 18 11:18:00 2016 +0100

    fix sort order to be by key alone, not key and value
    
    Sorting with the value part of the statement means that
    "perl5=foo" sorts before "perl=foo", where sorting by the
    keys alone would put "perl" before "perl5".
    
    This makes the order in the data correspond to what you
    would see with sort keys %Config.

M       configpm
-----------------------------------------------------------------------

Summary of changes:
 configpm | 11 +++++++++--
 toke.c   |  9 ++++-----
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/configpm b/configpm
index c62f0fc3bf..d2ba35cec3 100755
--- a/configpm
+++ b/configpm
@@ -557,8 +557,15 @@ sub myconfig {
 local *_ = \my $a;
 $_ = <<'!END!';
 EOT
-
-$heavy_txt .= join('', sort @v_others) . "!END!\n";
+#proper lexicographical order of the keys
+$heavy_txt .= join('',
+    map { $_->[-1] }
+    sort {$a->[0] cmp $b->[0] }
+    map {
+        /^([^=]+)/ ? [ $1, $_ ]
+                   : [ $_, $_ ] # shouldnt happen
+    } @v_others
+) . "!END!\n";
 
 # Only need the dynamic byteorder code in Config.pm if 'byteorder' is one of
 # the precached keys
diff --git a/toke.c b/toke.c
index 11abf2b1b2..1c88d8a2ee 100644
--- a/toke.c
+++ b/toke.c
@@ -9897,8 +9897,8 @@ S_scan_heredoc(pTHX_ char *s)
        STRLEN herelen = SvCUR(tmpstr);
        char *ss = SvPVX(tmpstr);
        char *se = ss + herelen;
-       SV *newstr = newSVpvs("");
-       SvGROW(newstr, herelen);
+        SV *newstr = newSV(herelen+1);
+        SvPOK_on(newstr);
 
        /* Trim leading whitespace */
        while (ss < se) {
@@ -9931,9 +9931,8 @@ S_scan_heredoc(pTHX_ char *s)
                );
            }
        }
-
-       sv_setsv(tmpstr,newstr);
-
+        /* avoid sv_setsv() as we dont wan't to COW here */
+        sv_setpvn(tmpstr,SvPVX(newstr),SvCUR(newstr));
        Safefree(indent);
        SvREFCNT_dec_NN(newstr);
     }

--
Perl5 Master Repository

Reply via email to