summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cop.h2
-rw-r--r--scope.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/cop.h b/cop.h
index e5370c4915..7d90891a50 100644
--- a/cop.h
+++ b/cop.h
@@ -732,7 +732,7 @@ struct context {
#define CxFOREACHDEF(c) ((CxTYPE_is_LOOP(c) && CxTYPE(c) != CXt_LOOP_PLAIN) \
&& ((c)->cx_type & CXp_FOR_DEF))
-#define CXINC (cxstack_ix < cxstack_max ? ++cxstack_ix : (cxstack_ix = cxinc()))
+#define CXINC ((cxstack_ix + 1) < cxstack_max ? ++cxstack_ix : (cxstack_ix = cxinc()))
/*
=head1 "Gimme" Values
diff --git a/scope.c b/scope.c
index 92e952360d..2d9e3834f2 100644
--- a/scope.c
+++ b/scope.c
@@ -77,10 +77,10 @@ Perl_cxinc(pTHX)
dVAR;
const IV old_max = cxstack_max;
cxstack_max = GROW(cxstack_max);
- Renew(cxstack, cxstack_max + 1, PERL_CONTEXT); /* XXX should fix CXINC macro */
+ Renew(cxstack, cxstack_max, PERL_CONTEXT);
/* Without any kind of initialising deep enough recursion
* will end up reading uninitialised PERL_CONTEXTs. */
- PoisonNew(cxstack + old_max + 1, cxstack_max - old_max, PERL_CONTEXT);
+ PoisonNew(cxstack + old_max, cxstack_max - old_max, PERL_CONTEXT);
return cxstack_ix + 1;
}