X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=xs-src%2FMouseUtil.xs;h=2d557a6c81331fa1039a68942a1cac2244eb8967;hb=beb51b30c36db012d0e8c7fdca87e44213ca81f5;hp=925d3d4da1ac4f17d0fbbca683ce430d1087a62d;hpb=8fcdb9973a1df1958b61059c8cef572780daf91d;p=gitmo%2FMouse.git diff --git a/xs-src/MouseUtil.xs b/xs-src/MouseUtil.xs index 925d3d4..2d557a6 100644 --- a/xs-src/MouseUtil.xs +++ b/xs-src/MouseUtil.xs @@ -120,54 +120,28 @@ mouse_throw_error(SV* const metaobject, SV* const data /* not used */, const cha } } -static I32 -S_dopoptosub(pTHX_ I32 const startingblock) -{ - const PERL_CONTEXT* const cxstk = cxstack; - I32 i; - for (i = startingblock; i >= 0; i--) { - const PERL_CONTEXT* const cx = &cxstk[i]; - - switch (CxTYPE(cx)) { - case CXt_EVAL: - case CXt_SUB: - case CXt_FORMAT: - return i; - } - } - return i; -} - /* workaround Perl-RT #69939 */ I32 mouse_call_sv_safe(pTHX_ SV* const sv, I32 const flags) { - const PERL_CONTEXT* const cx = &cxstack[S_dopoptosub(aTHX_ cxstack_ix)]; - assert( (flags & G_EVAL) == 0 ); - - //warn("cx_type=0x%02x PL_eval=0x%02x (%"SVf")", (unsigned)cx->cx_type, (unsigned)PL_in_eval, sv); - if(cx->cx_type & CXp_TRYBLOCK) { - return Perl_call_sv(aTHX_ sv, flags); - } - else { - I32 count; - ENTER; - /* Don't do SAVETMPS */ + I32 count; + ENTER; + /* Don't do SAVETMPS */ - SAVESPTR(ERRSV); - ERRSV = sv_newmortal(); + SAVESPTR(ERRSV); + ERRSV = sv_newmortal(); - count = Perl_call_sv(aTHX_ sv, flags | G_EVAL); - - if(sv_true(ERRSV)){ - SV* const err = sv_mortalcopy(ERRSV); - LEAVE; - croak("Exception caught: %"SVf, err); /* rethrow */ - } + count = Perl_call_sv(aTHX_ sv, flags | G_EVAL); + if(sv_true(ERRSV)){ + SV* const err = sv_mortalcopy(ERRSV); LEAVE; - - return count; + sv_setsv(ERRSV, err); + croak(NULL); /* rethrow */ } + + LEAVE; + + return count; } void @@ -374,7 +348,7 @@ mouse_install_sub(pTHX_ GV* const gv, SV* const code_ref) { } } - CvGV(cv) = gv; + CvGV_set(cv, gv); CvANON_off(cv); } }