This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix READONLY hashes:
authorNick Ing-Simmons <nik@tiuk.ti.com>
Wed, 19 Dec 2001 10:19:40 +0000 (10:19 +0000)
committerNick Ing-Simmons <nik@tiuk.ti.com>
Wed, 19 Dec 2001 10:19:40 +0000 (10:19 +0000)
 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

hv.c
scope.c

diff --git a/hv.c b/hv.c
index 05f6deb..d0859d8 100644 (file)
--- 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 (file)
--- 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))