diff options
author | David Mitchell <davem@iabyn.com> | 2010-10-08 16:22:42 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2010-10-11 00:41:17 +0100 |
commit | 5239d5c4bfde4ec02e1787e9dc9ada189ad868e5 (patch) | |
tree | ef99f9e7b774932ec23897640acb6292506ba4d8 /proto.h | |
parent | de61950ae56ef8b3703b4fd7a5fd7fea866f893c (diff) | |
download | perl-5239d5c4bfde4ec02e1787e9dc9ada189ad868e5.tar.gz |
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.
Diffstat (limited to 'proto.h')
-rw-r--r-- | proto.h | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -3897,10 +3897,10 @@ PERL_CALLCONV void Perl_sv_chop(pTHX_ SV *const sv, const char *const ptr) PERL_CALLCONV I32 Perl_sv_clean_all(pTHX); PERL_CALLCONV void Perl_sv_clean_objs(pTHX); -PERL_CALLCONV void Perl_sv_clear(pTHX_ SV *const sv) +PERL_CALLCONV void Perl_sv_clear(pTHX_ SV *const orig_sv) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_SV_CLEAR \ - assert(sv) + assert(orig_sv) PERL_CALLCONV I32 Perl_sv_cmp(pTHX_ SV *const sv1, SV *const sv2); PERL_CALLCONV I32 Perl_sv_cmp_flags(pTHX_ SV *const sv1, SV *const sv2, const I32 flags); |