From: Nick Ing-Simmons Date: Wed, 19 Dec 2001 10:19:40 +0000 (+0000) Subject: Fix READONLY hashes: X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a26e96dff1c9d91b0bf389e6149016d8a3f26e49;p=p5sagit%2Fp5-mst-13.2.git Fix READONLY hashes: 1. Discovered need for disabled scope.c part of Jeff's patch. 2. Corrected hv_delete* - entry was being de-linked from chain (patch program not smart enough?) p4raw-id: //depot/perlio@13795 --- diff --git a/hv.c b/hv.c index 05f6deb..d0859d8 100644 --- a/hv.c +++ b/hv.c @@ -768,9 +768,6 @@ Perl_hv_delete(pTHX_ HV *hv, const char *key, I32 klen, I32 flags) Perl_hv_notallowed(aTHX_ is_utf8, key, klen, keysave); } - *oentry = HeNEXT(entry); - if (i && !*oentry) - xhv->xhv_fill--; /* HvFILL(hv)-- */ if (flags & G_DISCARD) sv = Nullsv; else { @@ -790,6 +787,9 @@ Perl_hv_delete(pTHX_ HV *hv, const char *key, I32 klen, I32 flags) * doesn't go down, but the number placeholders goes up */ xhv->xhv_placeholders++; /* HvPLACEHOLDERS(hv)++ */ } else { + *oentry = HeNEXT(entry); + if (i && !*oentry) + xhv->xhv_fill--; /* HvFILL(hv)-- */ if (entry == xhv->xhv_eiter /* HvEITER(hv) */) HvLAZYDEL_on(hv); else @@ -911,9 +911,6 @@ Perl_hv_delete_ent(pTHX_ HV *hv, SV *keysv, I32 flags, U32 hash) Perl_hv_notallowed(aTHX_ is_utf8, key, klen, keysave); } - *oentry = HeNEXT(entry); - if (i && !*oentry) - xhv->xhv_fill--; /* HvFILL(hv)-- */ if (flags & G_DISCARD) sv = Nullsv; else { @@ -933,6 +930,9 @@ Perl_hv_delete_ent(pTHX_ HV *hv, SV *keysv, I32 flags, U32 hash) * doesn't go down, but the number placeholders goes up */ xhv->xhv_placeholders++; /* HvPLACEHOLDERS(hv)++ */ } else { + *oentry = HeNEXT(entry); + if (i && !*oentry) + xhv->xhv_fill--; /* HvFILL(hv)-- */ if (entry == xhv->xhv_eiter /* HvEITER(hv) */) HvLAZYDEL_on(hv); else diff --git a/scope.c b/scope.c index da5fa6b..7c02951 100644 --- a/scope.c +++ b/scope.c @@ -827,9 +827,8 @@ Perl_leave_scope(pTHX_ I32 base) * if a my variable that was made readonly is going out of * scope, we want to remove the readonlyness so that it can * go out of scope quietly - * Disabled as I don't see need yet NI-S 2001/12/18 */ - if (0 && SvPADMY(sv) && ! SvFAKE(sv)) + if (SvPADMY(sv) && !SvFAKE(sv)) SvREADONLY_off(sv); if (SvTHINKFIRST(sv))