X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=xs-src%2FMouseTypeConstraints.xs;h=5260d8802f95f6c8778f625d4e93e01ec8f3f9e9;hb=ca861dd989ddc9868e5c69a39844e1e888bb9508;hp=741e679ce9b9b60e22643eb34376d5dcbd0d1c3b;hpb=aa2d2e2c0621cdcb8b2ec7cf49beb3a9de11803c;p=gitmo%2FMouse.git diff --git a/xs-src/MouseTypeConstraints.xs b/xs-src/MouseTypeConstraints.xs index 741e679..5260d88 100644 --- a/xs-src/MouseTypeConstraints.xs +++ b/xs-src/MouseTypeConstraints.xs @@ -84,7 +84,7 @@ mouse_tc_Bool(pTHX_ SV* const data PERL_UNUSED_DECL, SV* const sv) { } } else{ - /* false must be boolean */ + /* any false value must be boolean */ return TRUE; } } @@ -261,6 +261,7 @@ mouse_parameterized_HashRef(pTHX_ SV* const param, SV* const sv) { SV* const value = hv_iterval(hv, he); SvGETMAGIC(value); if(!mouse_tc_check(aTHX_ param, value)){ + hv_iterinit(hv); /* reset */ return FALSE; } } @@ -571,13 +572,11 @@ void compile_type_constraint(SV* self) CODE: { - AV* const checks = newAV(); + AV* const checks = newAV_mortal(); SV* check; /* check function */ SV* parent; SV* types_ref; - sv_2mortal((SV*)checks); - for(parent = get_slots(self, "parent"); parent; parent = get_slots(parent, "parent")){ check = get_slots(parent, "hand_optimized_type_constraint"); if(check && SvOK(check)){ @@ -621,8 +620,7 @@ CODE: types = (AV*)SvRV(types_ref); len = av_len(types) + 1; - union_checks = newAV(); - sv_2mortal((SV*)union_checks); + union_checks = newAV_mortal(); for(i = 0; i < len; i++){ SV* const tc = *av_fetch(types, i, TRUE);