if (items > A) { \
SV *lsv = ST(A); \
if (SvOK(lsv)) \
- level = SvUV(lsv); \
+ level = SvIV(lsv); \
if (level < 0) \
XSRETURN(0); \
} \
#define SU_DOPOPTOCX(t) \
STMT_START { \
- I32 i, cxix = cxstack_ix, from = 0; \
- if (items) \
- from = SvIV(ST(0)); \
- for (i = cxix - from; i >= 0; --i) { \
+ I32 i, cxix = cxstack_ix, level = 0; \
+ if (items) { \
+ SV *lsv = ST(0); \
+ if (SvOK(lsv)) \
+ level = SvIV(lsv); \
+ if (level < 0) \
+ level = 0; \
+ else if (level > cxix) \
+ level = cxix; \
+ } \
+ for (i = cxix - level; i >= 0; --i) { \
if (CxTYPE(&cxstack[i]) == t) { \
ST(0) = sv_2mortal(newSViv(cxix - i)); \
XSRETURN(1); \
#else
dXSARGS;
#endif
- I32 from = 0, cxix = cxstack_ix;
+ I32 level = 0, cxix = cxstack_ix;
su_ud_unwind *ud;
- SV *level;
PERL_UNUSED_VAR(cv); /* -W */
PERL_UNUSED_VAR(ax); /* -Wall */
if (items) {
- from = SvIV(ST(items - 1));
- if (from < 0)
- from = 0;
- else if (from > cxix)
- from = cxix;
+ SV *lsv = ST(items - 1);
+ if (SvOK(lsv))
+ level = SvIV(lsv);
+ if (level < 0)
+ level = 0;
+ else if (level > cxix)
+ level = cxix;
}
- cxix -= from;
+ cxix -= level;
do {
PERL_CONTEXT *cx = cxstack + cxix;
switch (CxTYPE(cx)) {