This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
make sv_clear() iterate over AVs
authorDavid Mitchell <davem@iabyn.com>
Fri, 8 Oct 2010 15:22:42 +0000 (16:22 +0100)
committerDavid Mitchell <davem@iabyn.com>
Sun, 10 Oct 2010 23:41:17 +0000 (00:41 +0100)
commit5239d5c4bfde4ec02e1787e9dc9ada189ad868e5
treeef99f9e7b774932ec23897640acb6292506ba4d8
parentde61950ae56ef8b3703b4fd7a5fd7fea866f893c
make sv_clear() iterate over AVs

In sv_clear(), rather than calling av_undef(), iterate over the AV's
elements. This is the first stage in making sv_clear() non-recursive,
and thus non-stack-blowing when freeing deeply nested structures.

Since we no longer have the stack to maintain the chain of AVs currently
being iterated over, we instead store a pointer to the previous AV in the
AvARRAY[AvMAX] slot of the currently-being-iterated AV. Since our first
action is to pop the first SV, that slot is guaranteed to be free, and
(in theory) nothing should be messing with the AV while we iterate over
its elements, so that slot should remain undisturbed.
embed.fnc
proto.h
sv.c