if(IsObject(instance)){
dMY_CXT;
HV* const instance_stash = SvSTASH(SvRV(instance));
- GV* const instance_isa = find_method_pvs(instance_stash, "isa");
+ GV* const myisa = find_method_pvs(instance_stash, "isa");
/* the instance has no own isa method */
- if(instance_isa == NULL || GvCV(instance_isa) == GvCV(MY_CXT.universal_isa)){
+ if(myisa == NULL || GvCV(myisa) == GvCV(MY_CXT.universal_isa)){
return stash == instance_stash
|| mouse_lookup_isa(aTHX_ instance_stash, HvNAME_get(stash));
}
/* the instance has its own isa method */
else {
- int retval;
- dSP;
+ SV* package;
+ int ok;
ENTER;
SAVETMPS;
- PUSHMARK(SP);
- EXTEND(SP, 2);
- PUSHs(instance);
- mPUSHp(HvNAME_get(stash), HvNAMELEN_get(stash));
- PUTBACK;
-
- call_sv((SV*)instance_isa, G_SCALAR);
-
- SPAGAIN;
- retval = sv_true(POPs);
- PUTBACK;
+ package = newSVpvn_share(HvNAME_get(stash), HvNAMELEN_get(stash), 0U);
+ ok = sv_true(mcall1s(instance, "isa", sv_2mortal(package)));
FREETMPS;
LEAVE;
- return retval;
+ return ok;
}
}
return FALSE;
}
else{
bool ok;
- dSP;
ENTER;
SAVETMPS;
- PUSHMARK(SP);
- EXTEND(SP, 2);
- PUSHs(instance);
- PUSHs(sv_mortalcopy(name));
- PUTBACK;
-
- call_method("can", G_SCALAR);
-
- SPAGAIN;
- ok = sv_true(POPs);
- PUTBACK;
+ ok = sv_true(mcall1s(instance, "can", sv_mortalcopy(name)));
FREETMPS;
LEAVE;