From: gfx Date: Sat, 27 Feb 2010 04:41:00 +0000 (+0900) Subject: Tidy the xs code X-Git-Tag: 0.50_05~9 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=caf77af6fd814a2b8de929227bd495b1472768c9;p=gitmo%2FMouse.git Tidy the xs code --- diff --git a/xs-src/MouseAccessor.xs b/xs-src/MouseAccessor.xs index 37c5ffd..ca0bb90 100644 --- a/xs-src/MouseAccessor.xs +++ b/xs-src/MouseAccessor.xs @@ -1,9 +1,9 @@ #include "mouse.h" -#define CHECK_INSTANCE(instance) STMT_START{ \ - if(!(SvROK(instance) && SvTYPE(SvRV(instance)) == SVt_PVHV)){ \ - croak("Invalid object instance"); \ - } \ +#define CHECK_INSTANCE(instance) STMT_START{ \ + if(!IsHashRef(instance)){ \ + croak("Invalid object instance"); \ + } \ } STMT_END @@ -88,10 +88,12 @@ mouse_push_values(pTHX_ SV* const value, U16 const flags){ PUSHs(svp ? *svp : &PL_sv_undef); } } - else if(flags & MOUSEf_TC_IS_HASHREF){ + else{ HV* hv; HE* he; + assert(flags & MOUSEf_TC_IS_HASHREF); + if(!IsHashRef(value)){ croak("Mouse-panic: Not a HASH reference"); }