diff options
author | Nicholas Clark <nick@ccl4.org> | 2007-10-18 10:44:35 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2007-10-18 10:44:35 +0000 |
commit | 19bad6733a83fa572b0d6a19b4693ea22c241ab0 (patch) | |
tree | 4d64f30b7146c090b4192d6c8e7bb13e2b773675 /gv.c | |
parent | c099d646ae4693eeb591d4c8cd9b629962f6b7e4 (diff) | |
download | perl-19bad6733a83fa572b0d6a19b4693ea22c241ab0.tar.gz |
Don't call strlen() on CopFILE() for the unthreaded case, because the
length can be obtained via CopFILESV().
p4raw-id: //depot/perl@32129
Diffstat (limited to 'gv.c')
-rw-r--r-- | gv.c | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -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); |