In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/a44d0896a6c4bfe01ea532694b8c1c073ea6a2f1?hp=8dbe7cf704038839ade17963855cf8bfad0c30a3>

- Log -----------------------------------------------------------------
commit a44d0896a6c4bfe01ea532694b8c1c073ea6a2f1
Author: Nicholas Clark <[email protected]>
Date:   Thu Oct 15 23:37:41 2009 +0100

    Skip testing the be_BY.CP1131 locale on Darwin 10, as it's still buggy.
    
    Correct infelicities in the regexp used to identify buggy locales on Darwin 
8
    and 9.

M       lib/locale.t

commit d3d348849d1e04f91e458937b2aba39c00de63af
Author: Nicholas Clark <[email protected]>
Date:   Thu Oct 15 23:17:02 2009 +0100

    Replace sv_2mortal(newSVpvn(...)) with newSVpvn_flags(..., SVs_TEMP)

M       ext/B/B.xs
M       ext/File-Glob/Glob.pm
M       ext/File-Glob/Glob.xs
M       ext/Opcode/Opcode.xs
M       ext/POSIX/POSIX.xs
M       ext/PerlIO-via/via.pm
M       ext/PerlIO-via/via.xs
M       ext/Socket/Makefile.PL
M       ext/Socket/Socket.pm
M       ext/Socket/Socket.xs

commit f584eb2d9f7ac11f83863d38a4f1f95cd9775aa2
Author: Nicholas Clark <[email protected]>
Date:   Thu Oct 15 20:02:51 2009 +0100

    Use newSVpvn(), newSVpvs() and gv_fetchpvs(), the later with proper 
arguments.
    
    Brought to you by the Campaign for the Elimination of strlen().

M       ext/POSIX/POSIX.xs

commit 352e1c09cf09498d4917c120c2055943a4301c0a
Author: Nicholas Clark <[email protected]>
Date:   Thu Oct 15 19:38:08 2009 +0100

    Use gv_stashsv() and gv_fetchpvs(), the later with proper arguments.
    
    Brought to you by the Campaign for the Elimination of strlen().
    (And the elimination of accidental bugs due to typos in lenghts of 
constants,
    and the elimination of abuse of boolean constants for parameters with more 
than
    2 values.)

M       ext/Opcode/Opcode.pm
M       ext/Opcode/Opcode.xs

commit 6beb30a667e08397498a369fab75270de918b033
Author: Nicholas Clark <[email protected]>
Date:   Thu Oct 15 18:51:16 2009 +0100

    Use sv_catpvs(), newSVpvs(), newSVpvn(), newSVhek(), gv_stashpvs() and the
    return value of sprintf().
    
    Brought to you by the Campaign for the Elimination of strlen().
    (And the elimination of accidental bugs due to typos in lengths of constant
    strings.)

M       ext/B/B.pm
M       ext/B/B.xs
-----------------------------------------------------------------------

Summary of changes:
 ext/B/B.pm             |    2 +-
 ext/B/B.xs             |  108 +++++++++++++++++++++++++-----------------------
 ext/File-Glob/Glob.pm  |    2 +-
 ext/File-Glob/Glob.xs  |    4 +-
 ext/Opcode/Opcode.pm   |    2 +-
 ext/Opcode/Opcode.xs   |   24 ++++++----
 ext/POSIX/POSIX.xs     |   22 +++++-----
 ext/PerlIO-via/via.pm  |    2 +-
 ext/PerlIO-via/via.xs  |    4 +-
 ext/Socket/Makefile.PL |    2 +-
 ext/Socket/Socket.pm   |    2 +-
 ext/Socket/Socket.xs   |   12 +++---
 lib/locale.t           |    7 ++-
 13 files changed, 102 insertions(+), 91 deletions(-)

diff --git a/ext/B/B.pm b/ext/B/B.pm
index d9428ec..f7d22f1 100644
--- a/ext/B/B.pm
+++ b/ext/B/B.pm
@@ -7,7 +7,7 @@
 #
 package B;
 
-our $VERSION = '1.22';
+our $VERSION = '1.23';
 
 use XSLoader ();
 require Exporter;
diff --git a/ext/B/B.xs b/ext/B/B.xs
index 186237f..2b6fb8d 100644
--- a/ext/B/B.xs
+++ b/ext/B/B.xs
@@ -331,35 +331,35 @@ make_mg_object(pTHX_ SV *arg, MAGIC *mg)
 static SV *
 cstring(pTHX_ SV *sv, bool perlstyle)
 {
-    SV *sstr = newSVpvn("", 0);
+    SV *sstr = newSVpvs("");
 
     if (!SvOK(sv))
-       sv_setpvn(sstr, "0", 1);
+       sv_setpvs(sstr, "0");
     else if (perlstyle && SvUTF8(sv)) {
        SV *tmpsv = sv_newmortal(); /* Temporary SV to feed sv_uni_display */
        const STRLEN len = SvCUR(sv);
        const char *s = sv_uni_display(tmpsv, sv, 8*len, UNI_DISPLAY_QQ);
-       sv_setpvn(sstr,"\"",1);
+       sv_setpvs(sstr,"\"");
        while (*s)
        {
            if (*s == '"')
-               sv_catpvn(sstr, "\\\"", 2);
+               sv_catpvs(sstr, "\\\"");
            else if (*s == '$')
-               sv_catpvn(sstr, "\\$", 2);
+               sv_catpvs(sstr, "\\$");
            else if (*s == '@')
-               sv_catpvn(sstr, "\\@", 2);
+               sv_catpvs(sstr, "\\@");
            else if (*s == '\\')
            {
                if (strchr("nrftax\\",*(s+1)))
                    sv_catpvn(sstr, s++, 2);
                else
-                   sv_catpvn(sstr, "\\\\", 2);
+                   sv_catpvs(sstr, "\\\\");
            }
            else /* should always be printable */
                sv_catpvn(sstr, s, 1);
            ++s;
        }
-       sv_catpv(sstr, "\"");
+       sv_catpvs(sstr, "\"");
        return sstr;
     }
     else
@@ -367,24 +367,24 @@ cstring(pTHX_ SV *sv, bool perlstyle)
        /* XXX Optimise? */
        STRLEN len;
        const char *s = SvPV(sv, len);
-       sv_catpv(sstr, "\"");
+       sv_catpvs(sstr, "\"");
        for (; len; len--, s++)
        {
            /* At least try a little for readability */
            if (*s == '"')
-               sv_catpv(sstr, "\\\"");
+               sv_catpvs(sstr, "\\\"");
            else if (*s == '\\')
-               sv_catpv(sstr, "\\\\");
+               sv_catpvs(sstr, "\\\\");
             /* trigraphs - bleagh */
             else if (!perlstyle && *s == '?' && len>=3 && s[1] == '?') {
                char escbuff[5]; /* to fit backslash, 3 octals + trailing \0 */
-                sprintf(escbuff, "\\%03o", '?');
-                sv_catpv(sstr, escbuff);
+               const STRLEN oct_len = my_sprintf(escbuff, "\\%03o", '?');
+                sv_catpvn(sstr, escbuff, oct_len);
             }
            else if (perlstyle && *s == '$')
-               sv_catpv(sstr, "\\$");
+               sv_catpvs(sstr, "\\$");
            else if (perlstyle && *s == '@')
-               sv_catpv(sstr, "\\@");
+               sv_catpvs(sstr, "\\@");
 #ifdef EBCDIC
            else if (isPRINT(*s))
 #else
@@ -392,30 +392,30 @@ cstring(pTHX_ SV *sv, bool perlstyle)
 #endif /* EBCDIC */
                sv_catpvn(sstr, s, 1);
            else if (*s == '\n')
-               sv_catpv(sstr, "\\n");
+               sv_catpvs(sstr, "\\n");
            else if (*s == '\r')
-               sv_catpv(sstr, "\\r");
+               sv_catpvs(sstr, "\\r");
            else if (*s == '\t')
-               sv_catpv(sstr, "\\t");
+               sv_catpvs(sstr, "\\t");
            else if (*s == '\a')
-               sv_catpv(sstr, "\\a");
+               sv_catpvs(sstr, "\\a");
            else if (*s == '\b')
-               sv_catpv(sstr, "\\b");
+               sv_catpvs(sstr, "\\b");
            else if (*s == '\f')
-               sv_catpv(sstr, "\\f");
+               sv_catpvs(sstr, "\\f");
            else if (!perlstyle && *s == '\v')
-               sv_catpv(sstr, "\\v");
+               sv_catpvs(sstr, "\\v");
            else
            {
                /* Don't want promotion of a signed -1 char in sprintf args */
                char escbuff[5]; /* to fit backslash, 3 octals + trailing \0 */
                const unsigned char c = (unsigned char) *s;
-               sprintf(escbuff, "\\%03o", c);
-               sv_catpv(sstr, escbuff);
+               const STRLEN oct_len = my_sprintf(escbuff, "\\%03o", c);
+               sv_catpvn(sstr, escbuff, oct_len);
            }
            /* XXX Add line breaks if string is long */
        }
-       sv_catpv(sstr, "\"");
+       sv_catpvs(sstr, "\"");
     }
     return sstr;
 }
@@ -423,13 +423,13 @@ cstring(pTHX_ SV *sv, bool perlstyle)
 static SV *
 cchar(pTHX_ SV *sv)
 {
-    SV *sstr = newSVpvn("'", 1);
+    SV *sstr = newSVpvs("'");
     const char *s = SvPV_nolen(sv);
 
     if (*s == '\'')
-       sv_catpvn(sstr, "\\'", 2);
+       sv_catpvs(sstr, "\\'");
     else if (*s == '\\')
-       sv_catpvn(sstr, "\\\\", 2);
+       sv_catpvs(sstr, "\\\\");
 #ifdef EBCDIC
     else if (isPRINT(*s))
 #else
@@ -437,29 +437,29 @@ cchar(pTHX_ SV *sv)
 #endif /* EBCDIC */
        sv_catpvn(sstr, s, 1);
     else if (*s == '\n')
-       sv_catpvn(sstr, "\\n", 2);
+       sv_catpvs(sstr, "\\n");
     else if (*s == '\r')
-       sv_catpvn(sstr, "\\r", 2);
+       sv_catpvs(sstr, "\\r");
     else if (*s == '\t')
-       sv_catpvn(sstr, "\\t", 2);
+       sv_catpvs(sstr, "\\t");
     else if (*s == '\a')
-       sv_catpvn(sstr, "\\a", 2);
+       sv_catpvs(sstr, "\\a");
     else if (*s == '\b')
-       sv_catpvn(sstr, "\\b", 2);
+       sv_catpvs(sstr, "\\b");
     else if (*s == '\f')
-       sv_catpvn(sstr, "\\f", 2);
+       sv_catpvs(sstr, "\\f");
     else if (*s == '\v')
-       sv_catpvn(sstr, "\\v", 2);
+       sv_catpvs(sstr, "\\v");
     else
     {
        /* no trigraph support */
        char escbuff[5]; /* to fit backslash, 3 octals + trailing \0 */
        /* Don't want promotion of a signed -1 char in sprintf args */
        unsigned char c = (unsigned char) *s;
-       sprintf(escbuff, "\\%03o", c);
-       sv_catpv(sstr, escbuff);
+       const STRLEN oct_len = my_sprintf(escbuff, "\\%03o", c);
+       sv_catpvn(sstr, escbuff, oct_len);
     }
-    sv_catpvn(sstr, "'", 1);
+    sv_catpvs(sstr, "'");
     return sstr;
 }
 
@@ -595,7 +595,7 @@ PROTOTYPES: DISABLE
 
 BOOT:
 {
-    HV *stash = gv_stashpvn("B", 1, GV_ADD);
+    HV *stash = gv_stashpvs("B", GV_ADD);
     AV *export_ok = perl_get_av("B::EXPORT_OK", GV_ADD);
     MY_CXT_INIT;
     specialsv_list[0] = Nullsv;
@@ -778,7 +778,7 @@ ppname(opnum)
     CODE:
        ST(0) = sv_newmortal();
        if (opnum >= 0 && opnum < PL_maxo) {
-           sv_setpvn(ST(0), "pp_", 3);
+           sv_setpvs(ST(0), "pp_");
            sv_catpv(ST(0), PL_op_name[opnum]);
        }
 
@@ -791,8 +791,8 @@ hash(sv)
        char hexhash[19]; /* must fit "0xffffffffffffffff" plus trailing \0 */
        const char *s = SvPV(sv, len);
        PERL_HASH(hash, s, len);
-       sprintf(hexhash, "0x%"UVxf, (UV)hash);
-       ST(0) = sv_2mortal(newSVpv(hexhash, 0));
+       len = my_sprintf(hexhash, "0x%"UVxf, (UV)hash);
+       ST(0) = newSVpvn_flags(hexhash, len, SVs_TEMP);
 
 #define cast_I32(foo) (I32)foo
 IV
@@ -843,7 +843,7 @@ threadsv_names()
 
        EXTEND(sp, len);
        for (i = 0; i < len; i++)
-           PUSHs(sv_2mortal(newSVpvn(&PL_threadsv_names[i], 1)));
+           PUSHs(newSVpvn_flags(&PL_threadsv_names[i], 1, SVs_TEMP));
 # endif
 #endif
 
@@ -895,11 +895,11 @@ OP_ppaddr(o)
        int i;
        SV *sv = sv_newmortal();
     CODE:
-       sv_setpvn(sv, "PL_ppaddr[OP_", 13);
+       sv_setpvs(sv, "PL_ppaddr[OP_");
        sv_catpv(sv, PL_op_name[o->op_type]);
        for (i=13; (STRLEN)i < SvCUR(sv); ++i)
            SvPVX(sv)[i] = toUPPER(SvPVX(sv)[i]);
-       sv_catpv(sv, "]");
+       sv_catpvs(sv, "]");
        ST(0) = sv;
 
 char *
@@ -1168,13 +1168,13 @@ PVOP_pv(o)
        {
            const short* const tbl = (short*)o->op_pv;
            const short entries = 257 + tbl[256];
-           ST(0) = sv_2mortal(newSVpv(o->op_pv, entries * sizeof(short)));
+           ST(0) = newSVpvn_flags(o->op_pv, entries * sizeof(short), SVs_TEMP);
        }
        else if (o->op_type == OP_TRANS) {
-           ST(0) = sv_2mortal(newSVpv(o->op_pv, 256 * sizeof(short)));
+           ST(0) = newSVpvn_flags(o->op_pv, 256 * sizeof(short), SVs_TEMP);
        }
        else
-           ST(0) = sv_2mortal(newSVpv(o->op_pv, 0));
+           ST(0) = newSVpvn_flags(o->op_pv, strlen(o->op_pv), SVs_TEMP);
 
 #define LOOP_redoop(o) o->op_redoop
 #define LOOP_nextop(o) o->op_nextop
@@ -1372,10 +1372,10 @@ packiv(sv)
            wp[0] = htonl(((U32)iv) >> (sizeof(UV)*4));
 #endif
            wp[1] = htonl(iv & 0xffffffff);
-           ST(0) = sv_2mortal(newSVpvn((char *)wp, 8));
+           ST(0) = newSVpvn_flags((char *)wp, 8, SVs_TEMP);
        } else {
            U32 w = htonl((U32)SvIVX(sv));
-           ST(0) = sv_2mortal(newSVpvn((char *)&w, 4));
+           ST(0) = newSVpvn_flags((char *)&w, 4, SVs_TEMP);
        }
 
 
@@ -1659,7 +1659,7 @@ BmTABLE(sv)
     CODE:
        str = SvPV(sv, len);
        /* Boyer-Moore table is just after string and its safety-margin \0 */
-       ST(0) = sv_2mortal(newSVpvn(str + len + PERL_FBM_TABLE_OFFSET, 256));
+       ST(0) = newSVpvn_flags(str + len + PERL_FBM_TABLE_OFFSET, 256, 
SVs_TEMP);
 
 MODULE = B     PACKAGE = B::GV         PREFIX = Gv
 
@@ -1667,7 +1667,11 @@ void
 GvNAME(gv)
        B::GV   gv
     CODE:
-       ST(0) = sv_2mortal(newSVpvn(GvNAME(gv), GvNAMELEN(gv)));
+#if PERL_VERSION >= 10
+       ST(0) = sv_2mortal(newSVhek(GvNAME_HEK(gv)));
+#else
+       ST(0) = newSVpvn_flags(GvNAME(gv), GvNAMELEN(gv), SVs_TEMP);
+#endif
 
 bool
 is_empty(gv)
diff --git a/ext/File-Glob/Glob.pm b/ext/File-Glob/Glob.pm
index 15d4adb..7c6b92c 100644
--- a/ext/File-Glob/Glob.pm
+++ b/ext/File-Glob/Glob.pm
@@ -56,7 +56,7 @@ use XSLoader ();
     ) ],
 );
 
-$VERSION = '1.06';
+$VERSION = '1.07';
 
 sub import {
     require Exporter;
diff --git a/ext/File-Glob/Glob.xs b/ext/File-Glob/Glob.xs
index 3a526fb..59345e7 100644
--- a/ext/File-Glob/Glob.xs
+++ b/ext/File-Glob/Glob.xs
@@ -59,8 +59,8 @@ PPCODE:
        EXTEND(sp, pglob.gl_pathc);
        for (i = 0; i < pglob.gl_pathc; i++) {
            /* printf("# bsd_glob: %s\n", pglob.gl_pathv[i]); */
-           tmp = sv_2mortal(newSVpvn(pglob.gl_pathv[i],
-                                     strlen(pglob.gl_pathv[i])));
+           tmp = newSVpvn_flags(pglob.gl_pathv[i], strlen(pglob.gl_pathv[i]),
+                                SVs_TEMP);
            TAINT;
            SvTAINT(tmp);
            PUSHs(tmp);
diff --git a/ext/Opcode/Opcode.pm b/ext/Opcode/Opcode.pm
index 31b6f44..9dbbce0 100644
--- a/ext/Opcode/Opcode.pm
+++ b/ext/Opcode/Opcode.pm
@@ -6,7 +6,7 @@ use strict;
 
 our($VERSION, @ISA, @EXPORT_OK);
 
-$VERSION = "1.14";
+$VERSION = "1.15";
 
 use Carp;
 use Exporter ();
diff --git a/ext/Opcode/Opcode.xs b/ext/Opcode/Opcode.xs
index 4bcb2e4..e1af6d5 100644
--- a/ext/Opcode/Opcode.xs
+++ b/ext/Opcode/Opcode.xs
@@ -260,12 +260,12 @@ BOOT:
 
 void
 _safe_pkg_prep(Package)
-    const char *Package
+    SV *Package
 PPCODE:
     HV *hv; 
     ENTER;
    
-    hv = gv_stashpv(Package, GV_ADDWARN); /* should exist already      */
+    hv = gv_stashsv(Package, GV_ADDWARN); /* should exist already      */
 
     if (strNE(HvNAME_get(hv),"main")) {
         /* make it think it's in main:: */
@@ -281,7 +281,7 @@ PPCODE:
 
 void
 _safe_call_sv(Package, mask, codesv)
-    char *     Package
+    SV *       Package
     SV *       mask
     SV *       codesv
 PPCODE:
@@ -298,7 +298,7 @@ PPCODE:
 
     save_hptr(&PL_defstash);           /* save current default stash   */
     /* the assignment to global defstash changes our sense of 'main'   */
-    PL_defstash = gv_stashpv(Package, GV_ADDWARN); /* should exist already     
*/
+    PL_defstash = gv_stashsv(Package, GV_ADDWARN); /* should exist already     
*/
 
     save_hptr(&PL_curstash);
     PL_curstash = PL_defstash;
@@ -306,13 +306,13 @@ PPCODE:
     /* defstash must itself contain a main:: so we'll add that now     */
     /* take care with the ref counts (was cause of long standing bug)  */
     /* XXX I'm still not sure if this is right, GV_ADDWARN should warn!        
*/
-    gv = gv_fetchpv("main::", GV_ADDWARN, SVt_PVHV);
+    gv = gv_fetchpvs("main::", GV_ADDWARN, SVt_PVHV);
     sv_free((SV*)GvHV(gv));
     GvHV(gv) = (HV*)SvREFCNT_inc(PL_defstash);
 
     /* %INC must be clean for use/require in compartment */
     dummy_hv = save_hash(PL_incgv);
-    GvHV(PL_incgv) = 
(HV*)SvREFCNT_inc(GvHV(gv_HVadd(gv_fetchpv("INC",TRUE,SVt_PVHV))));
+    GvHV(PL_incgv) = 
(HV*)SvREFCNT_inc(GvHV(gv_HVadd(gv_fetchpvs("INC",GV_ADD,SVt_PVHV))));
 
     /* Invalidate ISA and method caches */
     ++PL_sub_generation;
@@ -371,7 +371,8 @@ PPCODE:
        const U16 bits = bitmap[i];
        for (j=0; j < 8 && myopcode < PL_maxo; j++, myopcode++) {
            if ( bits & (1 << j) )
-               XPUSHs(sv_2mortal(newSVpv(names[myopcode], 0)));
+               XPUSHs(newSVpvn_flags(names[myopcode], strlen(names[myopcode]),
+                                     SVs_TEMP));
        }
     }
     }
@@ -458,7 +459,7 @@ PPCODE:
 
     /* copy args to a scratch area since we may push output values onto        
*/
     /* the stack faster than we read values off it if masks are used.  */
-    args = (SV**)SvPVX(sv_2mortal(newSVpvn((char*)&ST(0), items*sizeof(SV*))));
+    args = (SV**)SvPVX(newSVpvn_flags((char*)&ST(0), items*sizeof(SV*), 
SVs_TEMP));
     for (i = 0; i < items; i++) {
        const char * const opname = SvPV(args[i], len);
        SV *bitspec = get_op_bitspec(aTHX_ opname, len, 1);
@@ -466,7 +467,8 @@ PPCODE:
            const int myopcode = SvIV(bitspec);
            if (myopcode < 0 || myopcode >= PL_maxo)
                croak("panic: opcode %d (%s) out of range",myopcode,opname);
-           XPUSHs(sv_2mortal(newSVpv(op_desc[myopcode], 0)));
+           XPUSHs(newSVpvn_flags(op_desc[myopcode], strlen(op_desc[myopcode]),
+                                 SVs_TEMP));
        }
        else if (SvPOK(bitspec) && SvCUR(bitspec) == (STRLEN)opset_len) {
            int b, j;
@@ -476,7 +478,9 @@ PPCODE:
                const U16 bits = bitmap[b];
                for (j=0; j < 8 && myopcode < PL_maxo; j++, myopcode++)
                    if (bits & (1 << j))
-                       XPUSHs(sv_2mortal(newSVpv(op_desc[myopcode], 0)));
+                       XPUSHs(newSVpvn_flags(op_desc[myopcode],
+                                             strlen(op_desc[myopcode]),
+                                             SVs_TEMP));
            }
        }
        else
diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs
index 8572367..eccbb31 100644
--- a/ext/POSIX/POSIX.xs
+++ b/ext/POSIX/POSIX.xs
@@ -1217,7 +1217,7 @@ sigaction(sig, optaction, oldaction = 0)
        {
            dVAR;
            POSIX__SigAction action;
-           GV *siggv = gv_fetchpv("SIG", TRUE, SVt_PVHV);
+           GV *siggv = gv_fetchpvs("SIG", GV_ADD, SVt_PVHV);
            struct sigaction act;
            struct sigaction oact;
            sigset_t sset;
@@ -1280,7 +1280,7 @@ sigaction(sig, optaction, oldaction = 0)
                XSRETURN_UNDEF;
            ENTER;
            /* Restore signal mask no matter how we exit this block. */
-           osset_sv = newSVpv((char *)(&osset), sizeof(sigset_t));
+           osset_sv = newSVpvn((char *)(&osset), sizeof(sigset_t));
            SAVEFREESV( osset_sv );
            SAVEDESTRUCTOR_X(restore_sigmask, osset_sv);
 
@@ -1295,7 +1295,7 @@ sigaction(sig, optaction, oldaction = 0)
                        sv_setsv(*svp, *sigsvp);
                }
                else {
-                       sv_setpv(*svp, "DEFAULT");
+                       sv_setpvs(*svp, "DEFAULT");
                }
                RETVAL = sigaction(sig, (struct sigaction *)0, & oact);
                if(RETVAL == -1)
@@ -1457,7 +1457,7 @@ nice(incr)
        errno = 0;
        if ((incr = nice(incr)) != -1 || errno == 0) {
            if (incr == 0)
-               XPUSHs(sv_2mortal(newSVpvn("0 but true", 10)));
+               XPUSHs(newSVpvs_flags("0 but true", SVs_TEMP));
            else
                XPUSHs(sv_2mortal(newSViv(incr)));
        }
@@ -1512,11 +1512,11 @@ uname()
        struct utsname buf;
        if (uname(&buf) >= 0) {
            EXTEND(SP, 5);
-           PUSHs(sv_2mortal(newSVpv(buf.sysname, 0)));
-           PUSHs(sv_2mortal(newSVpv(buf.nodename, 0)));
-           PUSHs(sv_2mortal(newSVpv(buf.release, 0)));
-           PUSHs(sv_2mortal(newSVpv(buf.version, 0)));
-           PUSHs(sv_2mortal(newSVpv(buf.machine, 0)));
+           PUSHs(newSVpvn_flags(buf.sysname, strlen(buf.sysname), SVs_TEMP));
+           PUSHs(newSVpvn_flags(buf.nodename, strlen(buf.nodename), SVs_TEMP));
+           PUSHs(newSVpvn_flags(buf.release, strlen(buf.release), SVs_TEMP));
+           PUSHs(newSVpvn_flags(buf.version, strlen(buf.version), SVs_TEMP));
+           PUSHs(newSVpvn_flags(buf.machine, strlen(buf.machine), SVs_TEMP));
        }
 #else
        uname((char *) 0); /* A stub to call not_here(). */
@@ -1813,8 +1813,8 @@ void
 tzname()
     PPCODE:
        EXTEND(SP,2);
-       PUSHs(sv_2mortal(newSVpvn(tzname[0],strlen(tzname[0]))));
-       PUSHs(sv_2mortal(newSVpvn(tzname[1],strlen(tzname[1]))));
+       PUSHs(newSVpvn_flags(tzname[0], strlen(tzname[0]), SVs_TEMP));
+       PUSHs(newSVpvn_flags(tzname[1], strlen(tzname[1]), SVs_TEMP));
 
 SysRet
 access(filename, mode)
diff --git a/ext/PerlIO-via/via.pm b/ext/PerlIO-via/via.pm
index 53d4358..077f0d1 100644
--- a/ext/PerlIO-via/via.pm
+++ b/ext/PerlIO-via/via.pm
@@ -1,5 +1,5 @@
 package PerlIO::via;
-our $VERSION = '0.08';
+our $VERSION = '0.09';
 use XSLoader ();
 XSLoader::load 'PerlIO::via';
 1;
diff --git a/ext/PerlIO-via/via.xs b/ext/PerlIO-via/via.xs
index fd5234a..a811578 100644
--- a/ext/PerlIO-via/via.xs
+++ b/ext/PerlIO-via/via.xs
@@ -155,7 +155,7 @@ PerlIOVia_pushed(pTHX_ PerlIO * f, const char *mode, SV * 
arg,
                    /* binmode() passes NULL - so find out what mode is */
                    mode = PerlIO_modestr(f,lmode);
                }
-               modesv = sv_2mortal(newSVpvn(mode, strlen(mode)));
+               modesv = newSVpvn_flags(mode, strlen(mode), SVs_TEMP);
                result = PerlIOVia_method(aTHX_ f, MYMethod(PUSHED), G_SCALAR,
                                     modesv, Nullsv);
                if (result) {
@@ -395,7 +395,7 @@ SSize_t
 PerlIOVia_unread(pTHX_ PerlIO * f, const void *vbuf, Size_t count)
 {
     PerlIOVia *s = PerlIOSelf(f, PerlIOVia);
-    SV *buf = sv_2mortal(newSVpvn((char *) vbuf, count));
+    SV *buf = newSVpvn_flags((char *) vbuf, count, SVs_TEMP);
     SV *result =
        PerlIOVia_method(aTHX_ f, MYMethod(UNREAD), G_SCALAR, buf, Nullsv);
     if (result)
diff --git a/ext/Socket/Makefile.PL b/ext/Socket/Makefile.PL
index 0389b70..d95d916 100644
--- a/ext/Socket/Makefile.PL
+++ b/ext/Socket/Makefile.PL
@@ -65,7 +65,7 @@ foreach qw (MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK 
MSG_PROXY SCM_RIGHTS);
 push @names, 
 {name => $_, type => "SV",
  pre=>"struct in_addr ip_address; ip_address.s_addr = htonl($_);",
- value => "sv_2mortal(newSVpvn((char *)&ip_address,sizeof ip_address ))",}
+ value => "newSVpvn_flags((char *)&ip_address,sizeof(ip_address), SVs_TEMP)",}
          foreach qw(INADDR_ANY INADDR_LOOPBACK INADDR_NONE INADDR_BROADCAST);
 
 WriteConstants(
diff --git a/ext/Socket/Socket.pm b/ext/Socket/Socket.pm
index 1a0b7c3..ac7866a 100644
--- a/ext/Socket/Socket.pm
+++ b/ext/Socket/Socket.pm
@@ -1,7 +1,7 @@
 package Socket;
 
 our($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
-$VERSION = "1.84";
+$VERSION = "1.85";
 
 =head1 NAME
 
diff --git a/ext/Socket/Socket.xs b/ext/Socket/Socket.xs
index 16b893b..339b771 100644
--- a/ext/Socket/Socket.xs
+++ b/ext/Socket/Socket.xs
@@ -276,7 +276,7 @@ inet_ntoa(ip_address_sv)
                ((addr.s_addr >> 16) & 0xFF),
                ((addr.s_addr >>  8) & 0xFF),
                ( addr.s_addr        & 0xFF));
-       ST(0) = sv_2mortal(newSVpvn(addr_str, strlen(addr_str)));
+       ST(0) = newSVpvn_flags(addr_str, strlen(addr_str), SVs_TEMP);
        Safefree(addr_str);
        }
 
@@ -347,7 +347,7 @@ pack_sockaddr_un(pathname)
        } else {
                addr_len = sizeof sun_ad;
        }
-       ST(0) = sv_2mortal(newSVpvn((char *)&sun_ad, addr_len));
+       ST(0) = newSVpvn_flags((char *)&sun_ad, addr_len, SVs_TEMP);
 #else
        ST(0) = (SV *) not_here("pack_sockaddr_un");
 #endif
@@ -392,7 +392,7 @@ unpack_sockaddr_un(sun_sv)
                     && addr_len < sizeof addr.sun_path; addr_len++);
        }
 
-       ST(0) = sv_2mortal(newSVpvn(addr.sun_path, addr_len));
+       ST(0) = newSVpvn_flags(addr.sun_path, addr_len, SVs_TEMP);
 #else
        ST(0) = (SV *) not_here("unpack_sockaddr_un");
 #endif
@@ -425,7 +425,7 @@ pack_sockaddr_in(port, ip_address_sv)
        sin.sin_family = AF_INET;
        sin.sin_port = htons(port);
        sin.sin_addr.s_addr = htonl(addr.s_addr);
-       ST(0) = sv_2mortal(newSVpvn((char *)&sin, sizeof sin));
+       ST(0) = newSVpvn_flags((char *)&sin, sizeof (sin), SVs_TEMP);
        }
 
 void
@@ -455,7 +455,7 @@ unpack_sockaddr_in(sin_sv)
 
        EXTEND(SP, 2);
        PUSHs(sv_2mortal(newSViv((IV) port)));
-       PUSHs(sv_2mortal(newSVpvn((char *)&ip_address, sizeof ip_address)));
+       PUSHs(newSVpvn_flags((char *)&ip_address, sizeof(ip_address), 
SVs_TEMP));
        }
 
 void
@@ -481,7 +481,7 @@ inet_ntop(af, ip_address_sv)
        Copy( ip_address, &addr, sizeof addr, char );
        inet_ntop(af, &addr, str, INET6_ADDRSTRLEN);
 
-       ST(0) = sv_2mortal(newSVpv(str, strlen(str)));
+       ST(0) = newSVpvn_flags(str, strlen(str), SVs_TEMP);
 #else
         ST(0) = (SV *)not_here("inet_ntop");
 #endif
diff --git a/lib/locale.t b/lib/locale.t
index aa8aa07..64d71c3 100644
--- a/lib/locale.t
+++ b/lib/locale.t
@@ -459,8 +459,11 @@ if ($^O eq 'darwin') {
     (my $v) = $Config{osvers} =~ /^(\d+)/;
     if ($v >= 8 and $v < 10) {
        debug "# Skipping eu_ES, be_BY locales -- buggy in Darwin\n";
-       @Locale = grep ! m/^(eu_ES|be_BY.CP1131$)/, @Locale;
-    }
+       @Locale = grep ! m/^(eu_ES|be_BY\.CP1131)$/, @Locale;
+    } elsif ($v < 11) {
+       debug "# Skipping be_BY locales -- buggy in Darwin\n";
+       @Locale = grep ! m/^be_BY\.CP1131$/, @Locale;
+    }  
 }
 
 @Locale = sort @Locale;

--
Perl5 Master Repository

Reply via email to