From: Nicholas Clark Date: Thu, 18 Oct 2007 10:44:35 +0000 (+0000) Subject: Don't call strlen() on CopFILE() for the unthreaded case, because the X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=19bad6733a83fa572b0d6a19b4693ea22c241ab0;p=p5sagit%2Fp5-mst-13.2.git Don't call strlen() on CopFILE() for the unthreaded case, because the length can be obtained via CopFILESV(). p4raw-id: //depot/perl@32129 --- diff --git a/gv.c b/gv.c index a3da747..241e616 100644 --- a/gv.c +++ b/gv.c @@ -170,10 +170,24 @@ GP * Perl_newGP(pTHX_ GV *const gv) { GP *gp; + U32 hash; +#ifdef USE_ITHREADS const char *const file = (PL_curcop && CopFILE(PL_curcop)) ? CopFILE(PL_curcop) : ""; - STRLEN len = strlen(file); - U32 hash; + const STRLEN len = strlen(file); +#else + SV *const temp_sv = CopFILESV(PL_curcop); + const char *file; + STRLEN len; + + if (temp_sv) { + file = SvPVX(temp_sv); + len = SvCUR(temp_sv); + } else { + file = ""; + len = 0; + } +#endif PERL_HASH(hash, file, len); diff --git a/toke.c b/toke.c index c992e8a..eb7c18c 100644 --- a/toke.c +++ b/toke.c @@ -824,8 +824,18 @@ S_incline(pTHX_ const char *s) if (t - s > 0) { const STRLEN len = t - s; #ifndef USE_ITHREADS - const char * const cf = CopFILE(PL_curcop); - STRLEN tmplen = cf ? strlen(cf) : 0; + SV *const temp_sv = CopFILESV(PL_curcop); + const char *cf; + STRLEN tmplen; + + if (temp_sv) { + cf = SvPVX(temp_sv); + tmplen = SvCUR(temp_sv); + } else { + cf = NULL; + tmplen = 0; + } + if (tmplen > 7 && strnEQ(cf, "(eval ", 6)) { /* must copy *{"::_<(eval N)[oldfilename:L]"} * to *{"::_