summaryrefslogtreecommitdiff
path: root/pad.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2014-08-30 10:26:58 -0700
committerFather Chrysostomos <sprout@cpan.org>2014-09-07 22:09:04 -0700
commite15888669ebd5c1db19f2bae1e163b4e30702dc9 (patch)
tree34700ac7fa0f764c1c596b49d7f4da013a7eec62 /pad.c
parent7928175efa34637177898e95a4d6b119801c01fb (diff)
downloadperl-e15888669ebd5c1db19f2bae1e163b4e30702dc9.tar.gz
op.c: Calculate hash for CvNAME_HEK
I assumed when I wrote that code that share_hek would calculate the hash, like most hash functions; but this internal function assumes the caller does it. Hence, CVs were not sharing their heks with other types of thingies that have heks. A CV named foo and a GV named foo would cause two heks of the same name to be present in the shared string table.
Diffstat (limited to 'pad.c')
-rw-r--r--pad.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/pad.c b/pad.c
index 42f373450f..68e1078904 100644
--- a/pad.c
+++ b/pad.c
@@ -2092,13 +2092,16 @@ S_cv_clone_pad(pTHX_ CV *proto, CV *cv, CV *outside, bool newcv)
/* my sub */
/* Just provide a stub, but name it. It will be
upgrade to the real thing on scope entry. */
+ U32 hash;
+ PERL_HASH(hash, SvPVX_const(namesv)+1,
+ SvCUR(namesv) - 1);
sv = newSV_type(SVt_PVCV);
CvNAME_HEK_set(
sv,
share_hek(SvPVX_const(namesv)+1,
SvCUR(namesv) - 1
* (SvUTF8(namesv) ? -1 : 1),
- 0)
+ hash)
);
}
else sv = SvREFCNT_inc(ppad[ix]);