Skip to content

Commit

Permalink
Move magic logic into tryAMAGICftest macro.
Browse files Browse the repository at this point in the history
  • Loading branch information
mauzo committed Mar 25, 2009
1 parent d3ebc3e commit 180b7b9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
16 changes: 16 additions & 0 deletions pp.h
Expand Up @@ -471,6 +471,22 @@ Does not use C<TARG>. See also C<XPUSHu>, C<mPUSHu> and C<PUSHu>.
#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)) \
Expand Down
12 changes: 1 addition & 11 deletions pp_sys.c
Expand Up @@ -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)
Expand Down

0 comments on commit 180b7b9

Please sign in to comment.