From: gfx Date: Sat, 31 Oct 2009 09:00:34 +0000 (+0900) Subject: Ensure backward compatiblity X-Git-Tag: 0.40_04~8 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7ca3334ff0bb84a93bbbbb2c3c77face9cdec93b;p=gitmo%2FMouse.git Ensure backward compatiblity --- diff --git a/xs-src/MouseTypeConstraints.xs b/xs-src/MouseTypeConstraints.xs index 6f0fe6c..27bf1a3 100644 --- a/xs-src/MouseTypeConstraints.xs +++ b/xs-src/MouseTypeConstraints.xs @@ -19,26 +19,22 @@ typedef int (*check_fptr_t)(pTHX_ SV* const data, SV* const sv); int mouse_tc_check(pTHX_ SV* const tc_code, SV* const sv) { CV* const cv = (CV*)SvRV(tc_code); - assert(SvTYPE(cv) == Svt_PVCV); + assert(SvTYPE(cv) == SVt_PVCV); - if(CvISXSUB(cv)){ /* can be built-in tc */ - if(CvXSUB(cv) == XS_Mouse__Util__TypeConstraints_Item){ - assert(CvXSUBANY(cv).any_iv > 0); + if(CvXSUB(cv) == XS_Mouse__Util__TypeConstraints_Item){ /* built-in */ + assert(CvXSUBANY(cv).any_iv > 0); - return mouse_builtin_tc_check(aTHX_ CvXSUBANY(cv).any_iv, sv); - } - else if(CvXSUB(cv) == XS_Mouse_parameterized_check){ - MAGIC* const mg = (MAGIC*)CvXSUBANY(cv).any_ptr; + return mouse_builtin_tc_check(aTHX_ CvXSUBANY(cv).any_iv, sv); + } + else if(CvXSUB(cv) == XS_Mouse_parameterized_check){ /* built-in, parameterizad */ + MAGIC* const mg = (MAGIC*)CvXSUBANY(cv).any_ptr; - assert(CvXSUBANY(cv).any_ptr != NULL); + assert(CvXSUBANY(cv).any_ptr != NULL); - /* call the check function directly, skipping call_sv() */ - return CALL_FPTR((check_fptr_t)mg->mg_ptr)(aTHX_ mg->mg_obj, sv); - } + /* call the check function directly, skipping call_sv() */ + return CALL_FPTR((check_fptr_t)mg->mg_ptr)(aTHX_ mg->mg_obj, sv); } - - /* user-defined type constraints */ - { + else { /* custom */ int ok; dSP;