make sv_clear() non-recursive on RVs
authorDavid Mitchell <davem@iabyn.com>
Sun, 10 Oct 2010 23:13:07 +0000 (00:13 +0100)
committerDavid Mitchell <davem@iabyn.com>
Sun, 10 Oct 2010 23:41:18 +0000 (00:41 +0100)
The previous two commits made it non-recursive on AVs. With that
machinery in place, it's now trivial to extend it to RVs too.
This means that now any depth nesting of AVs and RVs will be freed
in a single call to sv_clear().

sv.c

diff --git a/sv.c b/sv.c
index da84e4f..1c8d6dd 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -6021,7 +6021,7 @@ Perl_sv_clear(pTHX_ SV *const orig_sv)
                    if (SvWEAKREF(sv))
                        sv_del_backref(target, sv);
                    else
-                       SvREFCNT_dec(target);
+                       next_sv = target;
                }
            }
 #ifdef PERL_OLD_COPY_ON_WRITE