From: Dave Rolsky Date: Fri, 11 Sep 2009 16:21:40 +0000 (-0500) Subject: MS VC++ compilation fix X-Git-Tag: 0.93~24 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ca2126106133419088523aefe7cf5d0c91524086;p=gitmo%2FClass-MOP.git MS VC++ compilation fix --- diff --git a/Changes b/Changes index 2adebdb..394a672 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,9 @@ Revision history for Perl extension Class-MOP. +Next + * mop.c + - Applied an MS VC++ compilation fix from Taro Nishino. RT #48072 + 0.92_01 Thu, Sep 10, 2009 * Class::MOP::Package - Backwards compatibility tweaks to XS for 5.8.1. (Goro Fuji) diff --git a/mop.c b/mop.c index 0d170be..aafaef7 100644 --- a/mop.c +++ b/mop.c @@ -78,6 +78,8 @@ mop_call0 (pTHX_ SV *const self, SV *const method) int mop_get_code_info (SV *coderef, char **pkg, char **name) { + GV *gv; + if (!SvOK(coderef) || !SvROK(coderef) || SvTYPE(SvRV(coderef)) != SVt_PVCV) { return 0; } @@ -95,12 +97,12 @@ mop_get_code_info (SV *coderef, char **pkg, char **name) */ if ( isGV_with_GP(CvGV(coderef)) ) { - GV *gv = CvGV(coderef); - *pkg = HvNAME( GvSTASH(gv) ? GvSTASH(gv) : CvSTASH(coderef) ); - *name = GvNAME( CvGV(coderef) ); + gv = CvGV(coderef); + *pkg = HvNAME( GvSTASH(gv) ? GvSTASH(gv) : CvSTASH(coderef) ); + *name = GvNAME( CvGV(coderef) ); } else { - *pkg = "__UNKNOWN__"; - *name = "__ANON__"; + *pkg = "__UNKNOWN__"; + *name = "__ANON__"; } return 1;