Compress::Zlib 1.35
[p5sagit/p5-mst-13.2.git] / universal.c
index 2b2dd45..4506f77 100644 (file)
@@ -338,7 +338,7 @@ XS(XS_UNIVERSAL_VERSION)
 
     gvp = pkg ? (GV**)hv_fetch(pkg,"VERSION",7,FALSE) : Null(GV**);
 
-    if (gvp && isGV(gv = *gvp) && SvOK(sv = GvSV(gv))) {
+    if (gvp && isGV(gv = *gvp) && (sv = GvSV(gv)) && SvOK(sv)) {
         SV *nsv = sv_newmortal();
         sv_setsv(nsv, sv);
         sv = nsv;
@@ -418,7 +418,7 @@ XS(XS_version_new)
            else {
                /* create empty object */
                vs = sv_newmortal();
-               sv_setpv(vs,"");
+               sv_setpvn(vs,"",0);
            }
        }
        else if ( items == 3 ) {
@@ -907,10 +907,12 @@ XS(XS_PerlIO_get_layers)
                  flgok = flgsvp && *flgsvp && SvIOK(*flgsvp);
 
                  if (details) {
-                      XPUSHs(namok ?
-                            newSVpv(SvPVX_const(*namsvp), 0) : &PL_sv_undef);
-                      XPUSHs(argok ?
-                            newSVpv(SvPVX_const(*argsvp), 0) : &PL_sv_undef);
+                      XPUSHs(namok
+                             ? newSVpvn(SvPVX_const(*namsvp), SvCUR(*namsvp))
+                             : &PL_sv_undef);
+                      XPUSHs(argok
+                             ? newSVpvn(SvPVX_const(*argsvp), SvCUR(*argsvp))
+                             : &PL_sv_undef);
                       if (flgok)
                            XPUSHi(SvIVX(*flgsvp));
                       else