From: Ben Morrow Date: Sun, 18 Jan 2009 08:35:23 +0000 (+0000) Subject: Move magic logic into tryAMAGICftest macro. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=180b7b9bf7b919003df56bf402fc3934dc71f196;p=p5sagit%2Fp5-mst-13.2.git Move magic logic into tryAMAGICftest macro. --- diff --git a/pp.h b/pp.h index 118c027..5c25b55 100644 --- a/pp.h +++ b/pp.h @@ -471,6 +471,22 @@ Does not use C. See also C, C and C. #define tryAMAGICunDEREF_var(meth_enum) \ tryAMAGICunW_var(meth_enum,setAGAIN,0,(void)0) +#define tryAMAGICftest(chr) \ + STMT_START { \ + if (SvAMAGIC(TOPs)) { \ + SV * const tmpsv = amagic_call(TOPs, \ + newSVpvn_flags(&chr, 1, SVs_TEMP), \ + ftest_amg, 0); \ + \ + if (tmpsv) { \ + SPAGAIN; \ + SETs(tmpsv); \ + RETURN; \ + } \ + } \ + } STMT_END + + #define opASSIGN (PL_op->op_flags & OPf_STACKED) #define SETsv(sv) STMT_START { \ if (opASSIGN || (SvFLAGS(TARG) & SVs_PADMY)) \ diff --git a/pp_sys.c b/pp_sys.c index ba3bd1b..1945b13 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -3048,17 +3048,7 @@ PP(pp_ftrread) break; } - if (SvAMAGIC(TOPs)) { - SV * const tmpsv = amagic_call(TOPs, - newSVpvn_flags(&opchar, 1, SVs_TEMP), - ftest_amg, 0); - - if (tmpsv) { - SPAGAIN; - SETs(tmpsv); - RETURN; - } - } + tryAMAGICftest(opchar); if (use_access) { #if defined(HAS_ACCESS) || defined (PERL_EFF_ACCESS)