diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-04-22 22:32:09 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-05-21 16:51:32 -0700 |
commit | e33525913afb6ff03f7a9e1f9881fd5ea6982f22 (patch) | |
tree | a1d8a854f5d7f8fc42bd43fb00c827944d0754ab /mg.c | |
parent | 6d77e8c75fe4eeaaa87223507d2214238206bf19 (diff) | |
download | perl-e33525913afb6ff03f7a9e1f9881fd5ea6982f22.tar.gz |
[perl #111000] Let hv_store work on hint hashes
Magic attached to hash elements has its key stored differently depend-
ing on how it was supplied to hv_common. hv_store passes a string/
length pair to hv_common, while hv_store_ent passes an SV.
magic_clearhint wasn’t able to handle string/length pairs, and only
worked with SVs, resulting in assertion failures or crashes.
This commit fixes magic_clearhint, so that XS code can use hv_store on
hint hashes.
Diffstat (limited to 'mg.c')
-rw-r--r-- | mg.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -3355,12 +3355,13 @@ Perl_magic_clearhint(pTHX_ SV *sv, MAGIC *mg) PERL_ARGS_ASSERT_MAGIC_CLEARHINT; PERL_UNUSED_ARG(sv); - assert(mg->mg_len == HEf_SVKEY); - PL_hints |= HINT_LOCALIZE_HH; CopHINTHASH_set(&PL_compiling, - cophh_delete_sv(CopHINTHASH_get(&PL_compiling), - MUTABLE_SV(mg->mg_ptr), 0, 0)); + mg->mg_len == HEf_SVKEY + ? cophh_delete_sv(CopHINTHASH_get(&PL_compiling), + MUTABLE_SV(mg->mg_ptr), 0, 0) + : cophh_delete_pvn(CopHINTHASH_get(&PL_compiling), + mg->mg_ptr, mg->mg_len, 0, 0)); return 0; } |