diff options
author | Vincent Pit <perl@profvince.com> | 2008-12-28 13:49:41 +0100 |
---|---|---|
committer | Vincent Pit <perl@profvince.com> | 2008-12-28 15:46:41 +0100 |
commit | c68ec7a9f950f968bb39608a47e0228e03511a18 (patch) | |
tree | 8c91cd97a32669a380b021b83db95db30a3e6e4b /scope.c | |
parent | d30e492cced9a7022652176a253f8f900679d9b0 (diff) | |
download | perl-c68ec7a9f950f968bb39608a47e0228e03511a18.tar.gz |
Add save_adelete()/SAVEADELETE() to save on the stack an array element delete
Diffstat (limited to 'scope.c')
-rw-r--r-- | scope.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -509,6 +509,17 @@ Perl_save_delete(pTHX_ HV *hv, char *key, I32 klen) } void +Perl_save_adelete(pTHX_ AV *av, I32 key) +{ + dVAR; + + PERL_ARGS_ASSERT_SAVE_ADELETE; + + SvREFCNT_inc_void(av); + save_pushi32ptr(key, av, SAVEt_ADELETE); +} + +void Perl_save_destructor(pTHX_ DESTRUCTORFUNC_NOCONTEXT_t f, void* p) { dVAR; @@ -864,6 +875,13 @@ Perl_leave_scope(pTHX_ I32 base) SvREFCNT_dec(hv); Safefree(ptr); break; + case SAVEt_ADELETE: + ptr = SSPOPPTR; + av = MUTABLE_AV(ptr); + i = SSPOPINT; + (void)av_delete(av, i, G_DISCARD); + SvREFCNT_dec(av); + break; case SAVEt_DESTRUCTOR_X: ptr = SSPOPPTR; (*SSPOPDXPTR)(aTHX_ ptr); |