diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1999-05-10 19:33:36 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1999-05-10 19:33:36 +0000 |
commit | 810b8aa5436a934d1a2016588cbacf9b55463c40 (patch) | |
tree | eabed90b74c878cc77d9ec21c13c0263fcc798a1 /mg.c | |
parent | 885f9e59968d66740b5c621739ead374e8e37a2b (diff) | |
download | perl-810b8aa5436a934d1a2016588cbacf9b55463c40.tar.gz |
"weak" references internals, still needs perlguts documentation
(somewhat modified version of patch suggested by Tuomas J. Lukka
<lukka@fas.harvard.edu>)
p4raw-id: //depot/perl@3385
Diffstat (limited to 'mg.c')
-rw-r--r-- | mg.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -1589,6 +1589,27 @@ vivify_defelem(SV *sv) } int +magic_killbackrefs(SV *sv, MAGIC *mg) +{ + AV *av = (AV*)mg->mg_obj; + SV **svp = AvARRAY(av); + I32 i = AvFILLp(av); + while (i >= 0) { + if (svp[i] && svp[i] != &PL_sv_undef) { + if (!SvWEAKREF(svp[i])) + croak("panic: magic_killbackrefs"); + /* XXX Should we check that it hasn't changed? */ + SvRV(svp[i]) = 0; + SvOK_off(svp[i]); + SvWEAKREF_off(svp[i]); + svp[i] = &PL_sv_undef; + } + i--; + } + return 0; +} + +int magic_setmglob(SV *sv, MAGIC *mg) { mg->mg_len = -1; |