summaryrefslogtreecommitdiff
path: root/pp.h
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2010-11-02 16:40:39 +0000
committerNicholas Clark <nick@ccl4.org>2010-11-02 16:40:39 +0000
commitf5d6f09660e01aad6e56a94e20e2fcda90381934 (patch)
treee15dcbadf57b0d3d1d491ad99f31f4553d46c92a /pp.h
parent9f8bf29815397e529be92022542fb51ea86d3fd5 (diff)
downloadperl-f5d6f09660e01aad6e56a94e20e2fcda90381934.tar.gz
Implement the loop in tryAMAGICunDEREF_var() using while, rather than goto.
Yes, it was a while loop implemented using goto, although this only became clear by untangling the macros. I believe it need never have been implemented as goto, given that the other user of tryAMAGICunW_var "broke" out of the "if"'s block using a return, hence that "if" could have been a "while" all along.
Diffstat (limited to 'pp.h')
-rw-r--r--pp.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/pp.h b/pp.h
index 8c7967c887..56337fc21d 100644
--- a/pp.h
+++ b/pp.h
@@ -453,18 +453,18 @@ Does not use C<TARG>. See also C<XPUSHu>, C<mPUSHu> and C<PUSHu>.
STMT_START { \
SV *tmpsv; \
SV *arg = *sp; \
- am_again: \
- if (SvAMAGIC(arg) && \
- (tmpsv = amagic_call(arg, &PL_sv_undef, meth_enum, \
- AMGf_noright | AMGf_unary))) { \
+ 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)) { \
- arg = tmpsv; \
- goto am_again; \
+ if (tmpsv == arg || SvRV(tmpsv) == SvRV(arg)) { \
+ /* Bail out if it returns us the same reference. */ \
+ break; \
} \
+ arg = tmpsv; \
} \
} STMT_END