X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/1b38c28e639da91d4507d4d1cebac12fec9e82ef..b73d44b75a8889e12ce79ed8e92a1b2a1ea25e8e:/pp.h?ds=sidebyside diff --git a/pp.h b/pp.h index 27f948c..4e663ba 100644 --- a/pp.h +++ b/pp.h @@ -449,27 +449,14 @@ Does not use C. See also C, C and C. } \ } STMT_END -#define tryAMAGICunDEREF_var(meth_enum) \ +/* This is no longer used anywhere in the core. You might wish to consider + calling amagic_deref_call() directly, as it has a cleaner interface. */ +#define tryAMAGICunDEREF(meth) \ STMT_START { \ - SV *tmpsv; \ - SV *arg = *sp; \ - while (SvAMAGIC(arg) && \ - (tmpsv = amagic_call(arg, &PL_sv_undef, meth_enum, \ - AMGf_noright | AMGf_unary))) { \ - SPAGAIN; \ - sv = tmpsv; \ - if (!SvROK(tmpsv)) \ - Perl_croak(aTHX_ "Overloaded dereference did not return a reference"); \ - if (tmpsv == arg || SvRV(tmpsv) == SvRV(arg)) { \ - /* Bail out if it returns us the same reference. */ \ - break; \ - } \ - arg = tmpsv; \ - } \ + sv = amagic_deref_call(*sp, CAT2(meth,_amg)); \ + SPAGAIN; \ } STMT_END -#define tryAMAGICunDEREF(meth) tryAMAGICunDEREF_var(CAT2(meth,_amg)) - #define opASSIGN (PL_op->op_flags & OPf_STACKED) #define SETsv(sv) STMT_START { \