Merge remote branch 'origin/more_than_32_bit_Int_on_32_bit_systems'
[gitmo/Mouse.git] / xs-src / MouseAccessor.xs
index b9aad70..fd4cf68 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(!(SvROK(instance) && SvTYPE(SvRV(instance)) == SVt_PVHV)){  \
+            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");
         }
@@ -132,7 +134,7 @@ mouse_attr_set(pTHX_ SV* const self, MAGIC* const mg, SV* value){
         value = mouse_xa_apply_type_constraint(aTHX_ MOUSE_mg_xa(mg), value, flags);
     }
 
-    set_slot(self, slot, value);
+    value = set_slot(self, slot, value);
 
     if(flags & MOUSEf_ATTR_IS_WEAK_REF){
         weaken_slot(self, slot);
@@ -388,7 +390,7 @@ mouse_instance_weaken_slot(pTHX_ SV* const instance, SV* const slot) {
         sv_rvweaken(HeVAL(he));
     }
 }
-\r
+
 MODULE = Mouse::Meta::Method::Accessor::XS  PACKAGE = Mouse::Meta::Method::Accessor::XS
 
 PROTOTYPES:   DISABLE
@@ -425,7 +427,7 @@ CV*
 _generate_clearer(klass, SV* attr, metaclass)
 CODE:
 {
-    SV* const slot = mcall0s(attr, "name");
+    SV* const slot = mcall0(attr, mouse_name);
     STRLEN len;
     const char* const pv = SvPV_const(slot, len);
     RETVAL = mouse_simple_accessor_generate(aTHX_ NULL, pv, len, XS_Mouse_simple_clearer, NULL, 0);
@@ -437,7 +439,7 @@ CV*
 _generate_predicate(klass, SV* attr, metaclass)
 CODE:
 {
-    SV* const slot = mcall0s(attr, "name");
+    SV* const slot = mcall0(attr, mouse_name);
     STRLEN len;
     const char* const pv = SvPV_const(slot, len);
     RETVAL = mouse_simple_accessor_generate(aTHX_ NULL, pv, len, XS_Mouse_simple_predicate, NULL, 0);