} STMT_END
T_CVREF
STMT_START {
- SV* const xsub_tmp_sv = $arg;
+ HV *st;
+ GV *gvp;
+ SV * const xsub_tmp_sv = $arg;
SvGETMAGIC(xsub_tmp_sv);
- if (SvROK(xsub_tmp_sv) && SvTYPE(SvRV(xsub_tmp_sv)) == SVt_PVCV){
- $var = (CV*)SvRV(xsub_tmp_sv);
- }
- else{
+ $var = sv_2cv(xsub_tmp_sv, &st, &gvp, 0);
+ if (!$var) {
Perl_croak(aTHX_ \"%s: %s is not a CODE reference\",
${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
\"$var\");
} STMT_END
T_CVREF_REFCOUNT_FIXED
STMT_START {
- SV* const xsub_tmp_sv = $arg;
+ HV *st;
+ GV *gvp;
+ SV * const xsub_tmp_sv = $arg;
SvGETMAGIC(xsub_tmp_sv);
- if (SvROK(xsub_tmp_sv) && SvTYPE(SvRV(xsub_tmp_sv)) == SVt_PVCV){
- $var = (CV*)SvRV(xsub_tmp_sv);
- }
- else{
+ $var = sv_2cv(xsub_tmp_sv, &st, &gvp, 0);
+ if (!$var) {
Perl_croak(aTHX_ \"%s: %s is not a CODE reference\",
${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
\"$var\");