From: Vincent Pit Date: Thu, 14 Feb 2008 15:21:29 +0000 (+0100) Subject: doio.c:Perl_my_lstat:/* XXX Do really need to be calling SvPV() all these times? */ X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b16276bb9e16a3b99d6fb450f4e0902e32b01f85;p=p5sagit%2Fp5-mst-13.2.git doio.c:Perl_my_lstat:/* XXX Do really need to be calling SvPV() all these times? */ From: "Vincent Pit" Message-ID: <37048.147.210.17.175.1202998889.squirrel@147.210.17.175> p4raw-id: //depot/perl@33310 --- diff --git a/doio.c b/doio.c index 16d8d01..6b0c9f2 100644 --- a/doio.c +++ b/doio.c @@ -1343,6 +1343,7 @@ Perl_my_lstat(pTHX) static const char no_prev_lstat[] = "The stat preceding -l _ wasn't an lstat"; dSP; SV *sv; + const char *file; if (PL_op->op_flags & OPf_REF) { EXTEND(SP,1); if (cGVOP_gv == PL_defgv) { @@ -1369,10 +1370,10 @@ Perl_my_lstat(pTHX) GvENAME((GV*) SvRV(sv))); return (PL_laststatval = -1); } - /* XXX Do really need to be calling SvPV() all these times? */ - sv_setpv(PL_statname,SvPV_nolen_const(sv)); - PL_laststatval = PerlLIO_lstat(SvPV_nolen_const(sv),&PL_statcache); - if (PL_laststatval < 0 && ckWARN(WARN_NEWLINE) && strchr(SvPV_nolen_const(sv), '\n')) + file = SvPV_nolen_const(sv); + sv_setpv(PL_statname,file); + PL_laststatval = PerlLIO_lstat(file,&PL_statcache); + if (PL_laststatval < 0 && ckWARN(WARN_NEWLINE) && strchr(file, '\n')) Perl_warner(aTHX_ packWARN(WARN_NEWLINE), PL_warn_nl, "lstat"); return PL_laststatval; } diff --git a/t/lib/warnings/9uninit b/t/lib/warnings/9uninit index e68407c..dd305e3 100644 --- a/t/lib/warnings/9uninit +++ b/t/lib/warnings/9uninit @@ -1287,7 +1287,6 @@ Use of uninitialized value $m1 in -f at - line 27. Use of uninitialized value $m1 in -d at - line 28. Use of uninitialized value $m1 in -p at - line 29. Use of uninitialized value $m1 in -l at - line 30. -Use of uninitialized value $m1 in -l at - line 30. Use of uninitialized value $m1 in -u at - line 31. Use of uninitialized value $m1 in -g at - line 32. Use of uninitialized value $m1 in -t at - line 34.