const MGWIZ *w;
#if VMG_HAS_PERL(5, 10, 0)
PERL_CONTEXT saved_cx;
+ I32 cxix;
#endif
unsigned int had_err, has_err, flags = G_SCALAR | G_EVAL;
int ret = 0;
/* This context should not be used anymore, but since we croak in places the
* core doesn't even dare to, some pointers to it may remain in the upper call
* stack. Make sure call_sv() doesn't clobber it. */
- if (cxstack_ix >= cxstack_max)
- Perl_cxinc(aTHX);
- saved_cx = cxstack[cxstack_ix + 1];
+ if (cxstack_ix < cxstack_max)
+ cxix = cxstack_ix + 1;
+ else
+ cxix = Perl_cxinc(aTHX);
+ saved_cx = cxstack[cxix];
#endif
call_sv(w->cb_free, flags);
#if VMG_HAS_PERL(5, 10, 0)
- cxstack[cxstack_ix + 1] = saved_cx;
+ cxstack[cxix] = saved_cx;
#endif
has_err = SvTRUE(ERRSV);