From: Jarkko Hietaniemi Date: Sat, 28 Jun 2003 17:30:52 +0000 (+0000) Subject: Retract #19867; the bug was really much simpler: X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3a676441c258924612d07e12c0faa7606e5bbba2;p=p5sagit%2Fp5-mst-13.2.git Retract #19867; the bug was really much simpler: the < max must be <= max instead. p4raw-id: //depot/perl@19874 --- diff --git a/hv.c b/hv.c index 6f6eca1..0bbebc6 100644 --- a/hv.c +++ b/hv.c @@ -1707,27 +1707,25 @@ Perl_hv_clear(pTHX_ HV *hv) if (SvREADONLY(hv)) { /* restricted hash: convert all keys to placeholders */ - HE* he; - - hv_iterinit(hv); - while ((he = hv_iternext_flags(hv, HV_ITERNEXT_WANTPLACEHOLDERS))) { - SV *val; - - val = hv_iterval(hv, he); - if (val != &PL_sv_undef) { /* not already placeholder */ - if (val && SvREADONLY(val)) { - SV* keysv = hv_iterkeysv(he); - - Perl_croak(aTHX_ - "Attempt to delete readonly key '%"SVf"' from a restricted hash", - keysv); - } - SvREFCNT_dec(val); - HeVAL(he) = &PL_sv_undef; - xhv->xhv_placeholders++; /* HvPLACEHOLDERS(hv)++ */ + I32 i; + HE* entry; + for (i = 0; i <= (I32) xhv->xhv_max; i++) { + entry = ((HE**)xhv->xhv_array)[i]; + for (; entry; entry = HeNEXT(entry)) { + /* not already placeholder */ + if (HeVAL(entry) != &PL_sv_undef) { + if (HeVAL(entry) && SvREADONLY(HeVAL(entry))) { + SV* keysv = hv_iterkeysv(entry); + Perl_croak(aTHX_ + "Attempt to delete readonly key '%"SVf"' from a restricted hash", + keysv); + } + SvREFCNT_dec(HeVAL(entry)); + HeVAL(entry) = &PL_sv_undef; + xhv->xhv_placeholders++; /* HvPLACEHOLDERS(hv)++ */ + } } } - hv_iterinit(hv); return; }