summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-05-02 22:19:56 +0000
committerNicholas Clark <nick@ccl4.org>2006-05-02 22:19:56 +0000
commit45e3480058a48be9675e10a3f8cf34c1b211df0e (patch)
treec1e5b896209572ee5bfcd29b4edf3d9fc3ba2cb4 /sv.c
parent2b0ba25f0d6d021046bdee174d0cd9d6e42ab48a (diff)
downloadperl-45e3480058a48be9675e10a3f8cf34c1b211df0e.tar.gz
Add a new hash key flag HVhek_UNSHARED, to mark all unshared hash keys.
Otherwise Perl_newSVhek(), called by Perl_hv_iterkeysv(), naively assumes that it can share any hash key directly. p4raw-id: //depot/perl@28069
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sv.c b/sv.c
index 1fb948bb26..e0e47e4046 100644
--- a/sv.c
+++ b/sv.c
@@ -6981,12 +6981,15 @@ Perl_newSVhek(pTHX_ const HEK *hek)
SvUTF8_on (sv);
Safefree (as_utf8); /* bytes_to_utf8() allocates a new string */
return sv;
- } else if (flags & HVhek_REHASH) {
+ } else if (flags & (HVhek_REHASH|HVhek_UNSHARED)) {
/* We don't have a pointer to the hv, so we have to replicate the
flag into every HEK. This hv is using custom a hasing
algorithm. Hence we can't return a shared string scalar, as
that would contain the (wrong) hash value, and might get passed
- into an hv routine with a regular hash */
+ into an hv routine with a regular hash.
+ Similarly, a hash that isn't using shared hash keys has to have
+ the flag in every key so that we know not to try to call
+ share_hek_kek on it. */
SV * const sv = newSVpvn (HEK_KEY(hek), HEK_LEN(hek));
if (HEK_UTF8(hek))