From: Dave Rolsky Date: Wed, 13 Apr 2011 13:53:11 +0000 (-0500) Subject: How much do I hate curly-less blocks in C? A lot. X-Git-Tag: 2.0100~232 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=54090f8c358d7ad3910c911fd95769e43fa693c8;p=gitmo%2FMoose.git How much do I hate curly-less blocks in C? A lot. --- diff --git a/xs/Moose.xs b/xs/Moose.xs index 986498b..18863db 100644 --- a/xs/Moose.xs +++ b/xs/Moose.xs @@ -96,13 +96,17 @@ STATIC int is_regexp (pTHX_ SV* sv) { SV* tmpsv; - if (SvMAGICAL(sv)) + if (SvMAGICAL(sv)) { mg_get(sv); + } + if (SvROK(sv) && - (tmpsv = (SV*) SvRV(sv)) && - SvTYPE(tmpsv) == SVt_PVMG && - (mg_find(tmpsv, PERL_MAGIC_qr))) + (tmpsv = (SV*) SvRV(sv)) && + SvTYPE(tmpsv) == SVt_PVMG && + (mg_find(tmpsv, PERL_MAGIC_qr))) { return TRUE; + } + return FALSE; } #endif @@ -155,8 +159,9 @@ MODULE = Moose PACKAGE = Moose::Util::TypeConstraints::OptimizedConstraints bool RegexpRef (SV *sv=NULL) INIT: - if (!items) + if (!items) { sv = DEFSV; + } CODE: RETVAL = SvRXOK(sv); OUTPUT: