summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1998-04-08 00:14:13 +0000
committerGurusamy Sarathy <gsar@cpan.org>1998-04-08 00:14:13 +0000
commitba3eb2af450c2577c20a691fb686a5e02955c48b (patch)
treea8cf1145dc0c922547f90f92d9c444715752d512 /mg.c
parent00dc2f4f23da07658d2634f904ac3a098aaa4153 (diff)
parent8c9208bc5764dada175aceff9d0b1938978d7db6 (diff)
downloadperl-ba3eb2af450c2577c20a691fb686a5e02955c48b.tar.gz
[asperl] integrate mainline changes
p4raw-id: //depot/asperl@884
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c43
1 files changed, 19 insertions, 24 deletions
diff --git a/mg.c b/mg.c
index 29fe0a403a..902a8534a2 100644
--- a/mg.c
+++ b/mg.c
@@ -702,7 +702,7 @@ magic_setenv(SV *sv, MAGIC *mg)
s++;
if (i >= sizeof tmpbuf /* too long -- assume the worst */
|| *tmpbuf != '/'
- || (Stat(tmpbuf, &st) == 0 && (st.st_mode & 2)) ) {
+ || (PerlLIO_stat(tmpbuf, &st) == 0 && (st.st_mode & 2)) ) {
MgTAINTEDDIR_on(mg);
return 0;
}
@@ -972,6 +972,7 @@ magic_setnkeys(SV *sv, MAGIC *mg)
return 0;
}
+/* caller is responsible for stack switching/cleanup */
STATIC int
magic_methcall(MAGIC *mg, char *meth, I32 flags, int n, SV *val)
{
@@ -1006,11 +1007,13 @@ magic_methpack(SV *sv, MAGIC *mg, char *meth)
ENTER;
SAVETMPS;
+ PUSHSTACK(SI_MAGIC);
if (magic_methcall(mg, meth, G_SCALAR, 2, NULL)) {
sv_setsv(sv, *stack_sp--);
}
+ POPSTACK();
FREETMPS;
LEAVE;
return 0;
@@ -1027,9 +1030,12 @@ magic_getpack(SV *sv, MAGIC *mg)
int
magic_setpack(SV *sv, MAGIC *mg)
-{
+{
+ dSP;
ENTER;
+ PUSHSTACK(SI_MAGIC);
magic_methcall(mg, "STORE", G_SCALAR|G_DISCARD, 3, sv);
+ POPSTACK();
LEAVE;
return 0;
}
@@ -1044,15 +1050,17 @@ magic_clearpack(SV *sv, MAGIC *mg)
U32
magic_sizepack(SV *sv, MAGIC *mg)
{
- dTHR;
+ dSP;
U32 retval = 0;
ENTER;
SAVETMPS;
+ PUSHSTACK(SI_MAGIC);
if (magic_methcall(mg, "FETCHSIZE", G_SCALAR, 2, NULL)) {
sv = *stack_sp--;
retval = (U32) SvIV(sv)-1;
}
+ POPSTACK();
FREETMPS;
LEAVE;
return retval;
@@ -1062,11 +1070,13 @@ int magic_wipepack(SV *sv, MAGIC *mg)
{
dSP;
+ ENTER;
+ PUSHSTACK(SI_MAGIC);
PUSHMARK(SP);
XPUSHs(mg->mg_obj);
PUTBACK;
- ENTER;
perl_call_method("CLEAR", G_SCALAR|G_DISCARD);
+ POPSTACK();
LEAVE;
return 0;
}
@@ -1079,6 +1089,7 @@ magic_nextpack(SV *sv, MAGIC *mg, SV *key)
ENTER;
SAVETMPS;
+ PUSHSTACK(SI_MAGIC);
PUSHMARK(SP);
EXTEND(SP, 2);
PUSHs(mg->mg_obj);
@@ -1089,6 +1100,7 @@ magic_nextpack(SV *sv, MAGIC *mg, SV *key)
if (perl_call_method(meth, G_SCALAR))
sv_setsv(key, *stack_sp--);
+ POPSTACK();
FREETMPS;
LEAVE;
return 0;
@@ -1821,17 +1833,13 @@ sighandler(int sig)
HV *st;
SV *sv, *tSv = Sv;
CV *cv = Nullcv;
- AV *oldstack;
OP *myop = op;
U32 flags = 0;
I32 o_save_i = savestack_ix, type;
- PERL_CONTEXT *cx;
XPV *tXpv = Xpv;
if (savestack_ix + 15 <= savestack_max)
flags |= 1;
- if (cxstack_ix < cxstack_max - 2)
- flags |= 2;
if (markstack_ptr < markstack_max - 2)
flags |= 4;
if (retstack_ix < retstack_max - 2)
@@ -1839,12 +1847,6 @@ sighandler(int sig)
if (scopestack_ix < scopestack_max - 3)
flags |= 16;
- if (flags & 2) { /* POPBLOCK may decrease cxstack too early. */
- cxstack_ix++; /* Protect from overwrite. */
- cx = &cxstack[cxstack_ix];
- type = cx->cx_type; /* Can be during partial write. */
- cx->cx_type = CXt_NULL; /* Make it safe for unwind. */
- }
if (!psig_ptr[sig])
die("Signal SIG%s received, but no signal handler set.\n",
sig_name[sig]);
@@ -1879,11 +1881,6 @@ sighandler(int sig)
goto cleanup;
}
- oldstack = curstack;
- if (curstack != signalstack)
- AvFILLp(signalstack) = 0;
- SWITCHSTACK(curstack, signalstack);
-
if(psig_name[sig]) {
sv = SvREFCNT_inc(psig_name[sig]);
flags |= 64;
@@ -1892,20 +1889,18 @@ sighandler(int sig)
sv = sv_newmortal();
sv_setpv(sv,sig_name[sig]);
}
+
+ PUSHSTACK(SI_SIGNAL);
PUSHMARK(SP);
PUSHs(sv);
PUTBACK;
perl_call_sv((SV*)cv, G_DISCARD);
- SWITCHSTACK(signalstack, oldstack);
+ POPSTACK();
cleanup:
if (flags & 1)
savestack_ix -= 8; /* Unprotect save in progress. */
- if (flags & 2) {
- cxstack[cxstack_ix].cx_type = type;
- cxstack_ix -= 1;
- }
if (flags & 4)
markstack_ptr--;
if (flags & 8)