Skip to content

Commit

Permalink
incorporate review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
FGasper authored and khwilliamson committed May 21, 2021
1 parent 3d71223 commit 77d67a7
Showing 1 changed file with 25 additions and 30 deletions.
55 changes: 25 additions & 30 deletions lib/ExtUtils/typemap
Expand Up @@ -218,41 +218,38 @@ T_REF_IV_REF
$var = *INT2PTR($type *, tmp);
}
else {
const char* typestr = SvROK($arg) ? \"ref: \" : SvOK($arg) ? \"scalar: \" : \"undef\";
const char* valstr = SvROK($arg) ? sv_2pvbyte_nolen($arg) : SvPV_nolen($arg);
Perl_croak_nocontext(\"%s: %s (%s%s) is not of type %s\",
const char* refstr = SvROK($arg) ? \"\" : SvOK($arg) ? \"scalar \" : \"undef\";
Perl_croak_nocontext(\"%s: Expected %s to be of type %s; got %s%\" SVf \" instead\",
${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
\"$var\",
typestr, valstr,
\"$ntype\");
\"$var\", \"$ntype\",
refstr, $arg
);
}
T_REF_IV_PTR
if (sv_isa($arg, \"${ntype}\")) {
IV tmp = SvIV((SV*)SvRV($arg));
$var = INT2PTR($type, tmp);
}
else {
const char* typestr = SvROK($arg) ? \"ref: \" : SvOK($arg) ? \"scalar: \" : \"undef\";
const char* valstr = SvROK($arg) ? sv_2pvbyte_nolen($arg) : SvPV_nolen($arg);
Perl_croak_nocontext(\"%s: %s (%s%s) is not of type %s\",
const char* refstr = SvROK($arg) ? \"\" : SvOK($arg) ? \"scalar \" : \"undef\";
Perl_croak_nocontext(\"%s: Expected %s to be of type %s; got %s%\" SVf \" instead\",
${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
\"$var\",
typestr, valstr,
\"$ntype\");
\"$var\", \"$ntype\",
refstr, $arg
);
}
T_PTROBJ
if (SvROK($arg) && sv_derived_from($arg, \"${ntype}\")) {
IV tmp = SvIV((SV*)SvRV($arg));
$var = INT2PTR($type,tmp);
}
else {
const char* typestr = SvROK($arg) ? \"ref: \" : SvOK($arg) ? \"scalar: \" : \"undef\";
const char* valstr = SvROK($arg) ? sv_2pvbyte_nolen($arg) : SvPV_nolen($arg);
Perl_croak_nocontext(\"%s: %s (%s%s) is not of type %s\",
const char* refstr = SvROK($arg) ? \"\" : SvOK($arg) ? \"scalar \" : \"undef\";
Perl_croak_nocontext(\"%s: Expected %s to be of type %s; got %s%\" SVf \" instead\",
${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
\"$var\",
typestr, valstr,
\"$ntype\");
\"$var\", \"$ntype\",
refstr, $arg
);
}
T_PTRDESC
if (sv_isa($arg, \"${ntype}\")) {
Expand All @@ -261,13 +258,12 @@ T_PTRDESC
$var = ${type}_desc->ptr;
}
else {
const char* typestr = SvROK($arg) ? \"ref: \" : SvOK($arg) ? \"scalar: \" : \"undef\";
const char* valstr = SvROK($arg) ? sv_2pvbyte_nolen($arg) : SvPV_nolen($arg);
Perl_croak_nocontext(\"%s: %s (%s%s) is not of type %s\",
const char* refstr = SvROK($arg) ? \"\" : SvOK($arg) ? \"scalar \" : \"undef\";
Perl_croak_nocontext(\"%s: Expected %s to be of type %s; got %s%\" SVf \" instead\",
${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
\"$var\",
typestr, valstr,
\"$ntype\");
\"$var\", \"$ntype\",
refstr, $arg
);
}
T_REFREF
if (SvROK($arg)) {
Expand All @@ -284,13 +280,12 @@ T_REFOBJ
$var = *INT2PTR($type,tmp);
}
else {
const char* typestr = SvROK($arg) ? \"ref: \" : SvOK($arg) ? \"scalar: \" : \"undef\";
const char* valstr = SvROK($arg) ? sv_2pvbyte_nolen($arg) : SvPV_nolen($arg);
Perl_croak_nocontext(\"%s: %s (%s%s) is not of type %s\",
const char* refstr = SvROK($arg) ? \"\" : SvOK($arg) ? \"scalar \" : \"undef\";
Perl_croak_nocontext(\"%s: Expected %s to be of type %s; got %s%\" SVf \" instead\",
${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
\"$var\",
typestr, valstr,
\"$ntype\");
\"$var\", \"$ntype\",
refstr, $arg
);
}
T_OPAQUE
$var = *($type *)SvPV_nolen($arg)
Expand Down

0 comments on commit 77d67a7

Please sign in to comment.