diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1998-10-17 03:00:40 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1998-10-17 03:00:40 +0000 |
commit | 9e35f4b3b47f076a1cad0f1048e606c50cb5ac32 (patch) | |
tree | c0ad90347af1cff8972c7f5500d889f11d12e3be /sv.c | |
parent | 32d8b6e578ec44eac9ae5b98b03f265909d36357 (diff) | |
download | perl-9e35f4b3b47f076a1cad0f1048e606c50cb5ac32.tar.gz |
skip readonly vars and unref references when doing a reset()
p4raw-id: //depot/perl@1998
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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); |