Tidy the xs code
gfx [Sat, 27 Feb 2010 04:41:00 +0000 (13:41 +0900)]
xs-src/MouseAccessor.xs

index 37c5ffd..ca0bb90 100644 (file)
@@ -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");
         }