summaryrefslogtreecommitdiff
path: root/gv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2007-10-18 10:44:35 +0000
committerNicholas Clark <nick@ccl4.org>2007-10-18 10:44:35 +0000
commit19bad6733a83fa572b0d6a19b4693ea22c241ab0 (patch)
tree4d64f30b7146c090b4192d6c8e7bb13e2b773675 /gv.c
parentc099d646ae4693eeb591d4c8cd9b629962f6b7e4 (diff)
downloadperl-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.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/gv.c b/gv.c
index a3da74715c..241e6167b6 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);