From: Gurusamy Sarathy Date: Sat, 17 Oct 1998 03:00:40 +0000 (+0000) Subject: skip readonly vars and unref references when doing a reset() X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9e35f4b3b47f076a1cad0f1048e606c50cb5ac32;p=p5sagit%2Fp5-mst-13.2.git skip readonly vars and unref references when doing a reset() p4raw-id: //depot/perl@1998 --- diff --git a/sv.c b/sv.c index ec224a3..ad38a87 100644 --- a/sv.c +++ b/sv.c @@ -3957,12 +3957,18 @@ sv_reset(register char *s, HV *stash) } for (i = 0; i <= (I32) HvMAX(stash); i++) { for (entry = HvARRAY(stash)[i]; - entry; - entry = HeNEXT(entry)) { + entry; + entry = HeNEXT(entry)) + { if (!todo[(U8)*HeKEY(entry)]) continue; gv = (GV*)HeVAL(entry); sv = GvSV(gv); + if (SvTHINKFIRST(sv)) { + if (!SvREADONLY(sv) && SvROK(sv)) + sv_unref(sv); + continue; + } (void)SvOK_off(sv); if (SvTYPE(sv) >= SVt_PV) { SvCUR_set(sv, 0);