diff options
author | David Mitchell <davem@iabyn.com> | 2010-12-30 16:29:12 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2010-12-31 12:01:48 +0000 |
commit | 31d632c315ee363ec7894471fe0f73dc96f5c042 (patch) | |
tree | dbfeaf1f0c28237ece34455e1c08645b62f2e1cc /pp.h | |
parent | ada6eeb82df60fbe63c781f1a102393fd56d104b (diff) | |
download | perl-31d632c315ee363ec7894471fe0f73dc96f5c042.tar.gz |
standardise amagic method naming
Some amagic-related macros take the full method enumeration name,
(e.g. "add_amg"); while others "helpfully" allow you to pass a shortened
version, ("add"), and do a CAT2(meth,_amg) behind the scenes.
Standardise on passing the full name; this makes it less confusing and
allows you to grep for the enumeration name in the source.
It updates two macros to accept full enumeration names: tryAMAGICunTARGET
(which isn't used outside the core apparently), and AMG_CALLun, which is
replaced by a new AMG_CALLunary (since AMG_CALLun is used outside the
core).
Diffstat (limited to 'pp.h')
-rw-r--r-- | pp.h | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -425,8 +425,11 @@ Does not use C<TARG>. See also C<XPUSHu>, C<mPUSHu> and C<PUSHu>. return NORMAL; \ } STMT_END -#define AMG_CALLun(sv,meth) \ - amagic_call(sv,&PL_sv_undef, CAT2(meth,_amg), AMGf_noright | AMGf_unary) +#define AMG_CALLunary(sv,meth) \ + amagic_call(sv,&PL_sv_undef, meth, AMGf_noright | AMGf_unary) + +/* No longer used in core. Use AMG_CALLunary instead */ +#define AMG_CALLun(sv,meth) AMG_CALLunary(sv, CAT2(meth,_amg)) #define tryAMAGICunTARGET(meth, shift) \ STMT_START { \ @@ -438,7 +441,7 @@ Does not use C<TARG>. See also C<XPUSHu>, C<mPUSHu> and C<PUSHu>. SV *tmpsv; \ SV *arg= sp[shift]; \ if (SvAMAGIC(arg) && \ - (tmpsv = amagic_call(arg, &PL_sv_undef, CAT2(meth,_amg), \ + (tmpsv = amagic_call(arg, &PL_sv_undef, meth, \ AMGf_noright | AMGf_unary))) { \ SPAGAIN; \ sp += shift; \ |