This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make sv.c:sv_clear account for UTF8 keys in PL_stashcache
authorBrian Fraser <fraserbn@gmail.com>
Thu, 29 Sep 2011 21:44:55 +0000 (14:44 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Thu, 6 Oct 2011 20:01:13 +0000 (13:01 -0700)
sv.c

diff --git a/sv.c b/sv.c
index e8df04f..eea8436 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -6074,7 +6074,7 @@ Perl_sv_clear(pTHX_ SV *const orig_sv)
                {
                    if (PL_stashcache)
                        (void)hv_delete(PL_stashcache, name,
-                           HvNAMELEN_get((HV*)sv), G_DISCARD);
+                           HvNAMEUTF8((HV*)sv) ? -HvNAMELEN_get((HV*)sv) : HvNAMELEN_get((HV*)sv), G_DISCARD);
                    hv_name_set((HV*)sv, NULL, 0, 0);
                }