summaryrefslogtreecommitdiff
path: root/scope.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1998-10-25 04:35:07 +0000
committerGurusamy Sarathy <gsar@cpan.org>1998-10-25 04:35:07 +0000
commitb9d12d37e2ae2c5ceee42d544260d4d6703f71e8 (patch)
tree21fddc7351f119e78c716f1be9dcc0b49b83d072 /scope.c
parentd931506569a96775e3023a9788567281463988c6 (diff)
downloadperl-b9d12d37e2ae2c5ceee42d544260d4d6703f71e8.tar.gz
properly restore PL_rsfp_filters after require
p4raw-id: //depot/perl@2051
Diffstat (limited to 'scope.c')
-rw-r--r--scope.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/scope.c b/scope.c
index eb43648f1b..b7a40ca0b1 100644
--- a/scope.c
+++ b/scope.c
@@ -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;