diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1998-10-25 04:35:07 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1998-10-25 04:35:07 +0000 |
commit | b9d12d37e2ae2c5ceee42d544260d4d6703f71e8 (patch) | |
tree | 21fddc7351f119e78c716f1be9dcc0b49b83d072 /scope.c | |
parent | d931506569a96775e3023a9788567281463988c6 (diff) | |
download | perl-b9d12d37e2ae2c5ceee42d544260d4d6703f71e8.tar.gz |
properly restore PL_rsfp_filters after require
p4raw-id: //depot/perl@2051
Diffstat (limited to 'scope.c')
-rw-r--r-- | scope.c | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -204,6 +204,18 @@ save_svref(SV **sptr) return save_scalar_at(sptr); } +/* Like save_svref(), but doesn't deal with magic. Can be used to + * restore a global SV to its prior contents, freeing new value. */ +void +save_generic_svref(SV **sptr) +{ + dTHR; + SSCHECK(3); + SSPUSHPTR(sptr); + SSPUSHPTR(SvREFCNT_inc(*sptr)); + SSPUSHINT(SAVEt_GENERIC_SVREF); +} + void save_gp(GV *gv, I32 empty) { @@ -578,6 +590,16 @@ leave_scope(I32 base) ptr = &GvSV(gv); SvREFCNT_dec(gv); goto restore_sv; + case SAVEt_GENERIC_SVREF: /* generic sv */ + value = (SV*)SSPOPPTR; + ptr = SSPOPPTR; + if (ptr) { + sv = *(SV**)ptr; + *(SV**)ptr = value; + SvREFCNT_dec(sv); + } + SvREFCNT_dec(value); + break; case SAVEt_SVREF: /* scalar reference */ value = (SV*)SSPOPPTR; ptr = SSPOPPTR; |