From 25a9ffce153b0e67cfefd260754edeb097da5be7 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Wed, 3 Nov 2010 14:57:11 +0000 Subject: Add Perl_amagic_deref_call() to implement the bulk of tryAMAGICunDEREF_var(). This removes around 300 bytes of object code from each place it was previously inlined. It also provides a better interface - quite a lot of the core currently bodges things by creating a local variable C to use the macro. Change the XS::APItest wrapper to amagic_deref_call(). --- pp.h | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'pp.h') diff --git a/pp.h b/pp.h index 27f948cfdc..3f2aea9dca 100644 --- a/pp.h +++ b/pp.h @@ -451,21 +451,8 @@ Does not use C. See also C, C and C. #define tryAMAGICunDEREF_var(meth_enum) \ 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(aTHX_ *sp, meth_enum); \ + SPAGAIN; \ } STMT_END #define tryAMAGICunDEREF(meth) tryAMAGICunDEREF_var(CAT2(meth,_amg)) -- cgit v1.2.1