summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2007-10-05 16:08:12 +0000
committerNicholas Clark <nick@ccl4.org>2007-10-05 16:08:12 +0000
commitfc92a12da48923c628ee65a44060ddf6a33f8c2d (patch)
tree018d678a45b828efc653dd273725faffd18fc6dc /mg.c
parentfbc891ce838d50f87f51648f1bf049f1eb5cda7a (diff)
downloadperl-fc92a12da48923c628ee65a44060ddf6a33f8c2d.tar.gz
As PL_hinthv is actually tied, need to call SvSETMAGIC() after the
store to it. Gosh, the tied hash API is clunky. p4raw-id: //depot/perl@32032
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/mg.c b/mg.c
index 8d98b6dd1b..827fe93b30 100644
--- a/mg.c
+++ b/mg.c
@@ -3008,7 +3008,8 @@ int
Perl_magic_sethint(pTHX_ SV *sv, MAGIC *mg)
{
dVAR;
- assert(mg->mg_len == HEf_SVKEY);
+ SV *key = (mg->mg_len == HEf_SVKEY) ? (SV *)mg->mg_ptr
+ : sv_2mortal(newSVpvn(mg->mg_ptr, mg->mg_len));
/* mg->mg_obj isn't being used. If needed, it would be possible to store
an alternative leaf in there, with PL_compiling.cop_hints being used if
@@ -3020,8 +3021,7 @@ Perl_magic_sethint(pTHX_ SV *sv, MAGIC *mg)
forgetting to do it, and consequent subtle errors. */
PL_hints |= HINT_LOCALIZE_HH;
PL_compiling.cop_hints_hash
- = Perl_refcounted_he_new(aTHX_ PL_compiling.cop_hints_hash,
- (SV *)mg->mg_ptr, sv);
+ = Perl_refcounted_he_new(aTHX_ PL_compiling.cop_hints_hash, key, sv);
return 0;
}