# define VTBL *vtbl
#endif
+static void restore_magic(pTHXo_ void *p);
+static void unwind_handler_stack(pTHXo_ void *p);
+
/*
* Use the "DESTRUCTOR" scope cleanup to reinstate magic.
*/
MGS* mgs;
assert(SvMAGICAL(sv));
- SAVEDESTRUCTOR(S_restore_magic, (void*)mgs_ix);
+ SAVEDESTRUCTOR(restore_magic, (void*)mgs_ix);
mgs = SSPTR(mgs_ix, MGS*);
mgs->mgs_sv = sv;
SvFLAGS(sv) |= (SvFLAGS(sv) & (SVp_IOK|SVp_NOK|SVp_POK)) >> PRIVSHIFT;
}
-STATIC void
-S_restore_magic(pTHX_ void *p)
-{
- dTHR;
- MGS* mgs = SSPTR((I32)p, MGS*);
- SV* sv = mgs->mgs_sv;
-
- if (!sv)
- return;
-
- if (SvTYPE(sv) >= SVt_PVMG && SvMAGIC(sv))
- {
- if (mgs->mgs_flags)
- SvFLAGS(sv) |= mgs->mgs_flags;
- else
- mg_magical(sv);
- if (SvGMAGICAL(sv))
- SvFLAGS(sv) &= ~(SVf_IOK|SVf_NOK|SVf_POK);
- }
-
- mgs->mgs_sv = NULL; /* mark the MGS structure as restored */
-
- /* If we're still on top of the stack, pop us off. (That condition
- * will be satisfied if restore_magic was called explicitly, but *not*
- * if it's being called via leave_scope.)
- * The reason for doing this is that otherwise, things like sv_2cv()
- * may leave alloc gunk on the savestack, and some code
- * (e.g. sighandler) doesn't expect that...
- */
- if (PL_savestack_ix == mgs->mgs_ss_ix)
- {
- I32 popval = SSPOPINT;
- assert(popval == SAVEt_DESTRUCTOR);
- PL_savestack_ix -= 2;
- popval = SSPOPINT;
- assert(popval == SAVEt_ALLOC);
- popval = SSPOPINT;
- PL_savestack_ix -= popval;
- }
-
-}
-
void
Perl_mg_magical(pTHX_ SV *sv)
{
mgp = &SvMAGIC(sv); /* Re-establish pointer after sv_upgrade */
}
- restore_magic((void*)mgs_ix);
+ restore_magic(aTHXo_ (void*)mgs_ix);
return 0;
}
(VTBL->svt_set)(aTHX_ sv, mg);
}
- restore_magic((void*)mgs_ix);
+ restore_magic(aTHXo_ (void*)mgs_ix);
return 0;
}
save_magic(mgs_ix, sv);
/* omit MGf_GSKIP -- not changed here */
len = (VTBL->svt_len)(aTHX_ sv, mg);
- restore_magic((void*)mgs_ix);
+ restore_magic(aTHXo_ (void*)mgs_ix);
return len;
}
}
save_magic(mgs_ix, sv);
/* omit MGf_GSKIP -- not changed here */
len = (VTBL->svt_len)(aTHX_ sv, mg);
- restore_magic((void*)mgs_ix);
+ restore_magic(aTHXo_ (void*)mgs_ix);
return len;
}
}
(VTBL->svt_clear)(aTHX_ sv, mg);
}
- restore_magic((void*)mgs_ix);
+ restore_magic(aTHXo_ (void*)mgs_ix);
return 0;
}
}
FreeEnvironmentStrings(envv);
# else
-# ifndef PERL_USE_SAFE_PUTENV
+# ifdef CYGWIN
+ I32 i;
+ for (i = 0; environ[i]; i++)
+ Safefree(environ[i]);
+# else
+# ifndef PERL_USE_SAFE_PUTENV
I32 i;
if (environ == PL_origenviron)
else
for (i = 0; environ[i]; i++)
safesysfree(environ[i]);
-# endif /* PERL_USE_SAFE_PUTENV */
+# endif /* PERL_USE_SAFE_PUTENV */
+# endif /* CYGWIN */
environ[0] = Nullch;
break;
case '\020': /* ^P */
PL_perldb = SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv);
+ if (PL_perldb && !PL_DBsingle)
+ init_debugger();
break;
case '\024': /* ^T */
#ifdef BIG_TIME
static SV* sig_sv;
-STATIC void
-S_unwind_handler_stack(pTHX_ void *p)
-{
- dTHR;
- U32 flags = *(U32*)p;
-
- if (flags & 1)
- PL_savestack_ix -= 5; /* Unprotect save in progress. */
- /* cxstack_ix-- Not needed, die already unwound it. */
- if (flags & 64)
- SvREFCNT_dec(sig_sv);
-}
-
Signal_t
Perl_sighandler(int sig)
{
if (flags & 1) {
PL_savestack_ix += 5; /* Protect save in progress. */
o_save_i = PL_savestack_ix;
- SAVEDESTRUCTOR(S_unwind_handler_stack, (void*)&flags);
+ SAVEDESTRUCTOR(unwind_handler_stack, (void*)&flags);
}
if (flags & 4)
PL_markstack_ptr++; /* Protect mark. */
}
+#ifdef PERL_OBJECT
+#define NO_XSLOCKS
+#include "XSUB.h"
+#endif
+
+static void
+restore_magic(pTHXo_ void *p)
+{
+ dTHR;
+ MGS* mgs = SSPTR((I32)p, MGS*);
+ SV* sv = mgs->mgs_sv;
+
+ if (!sv)
+ return;
+
+ if (SvTYPE(sv) >= SVt_PVMG && SvMAGIC(sv))
+ {
+ if (mgs->mgs_flags)
+ SvFLAGS(sv) |= mgs->mgs_flags;
+ else
+ mg_magical(sv);
+ if (SvGMAGICAL(sv))
+ SvFLAGS(sv) &= ~(SVf_IOK|SVf_NOK|SVf_POK);
+ }
+
+ mgs->mgs_sv = NULL; /* mark the MGS structure as restored */
+
+ /* If we're still on top of the stack, pop us off. (That condition
+ * will be satisfied if restore_magic was called explicitly, but *not*
+ * if it's being called via leave_scope.)
+ * The reason for doing this is that otherwise, things like sv_2cv()
+ * may leave alloc gunk on the savestack, and some code
+ * (e.g. sighandler) doesn't expect that...
+ */
+ if (PL_savestack_ix == mgs->mgs_ss_ix)
+ {
+ I32 popval = SSPOPINT;
+ assert(popval == SAVEt_DESTRUCTOR);
+ PL_savestack_ix -= 2;
+ popval = SSPOPINT;
+ assert(popval == SAVEt_ALLOC);
+ popval = SSPOPINT;
+ PL_savestack_ix -= popval;
+ }
+
+}
+
+static void
+unwind_handler_stack(pTHXo_ void *p)
+{
+ dTHR;
+ U32 flags = *(U32*)p;
+
+ if (flags & 1)
+ PL_savestack_ix -= 5; /* Unprotect save in progress. */
+ /* cxstack_ix-- Not needed, die already unwound it. */
+ if (flags & 64)
+ SvREFCNT_dec(sig_sv);
+}