summaryrefslogtreecommitdiffstats
path: root/generic/tclExecute.c
diff options
context:
space:
mode:
authortwylite <twylite@crypt.co.za>2012-08-08 15:28:09 (GMT)
committertwylite <twylite@crypt.co.za>2012-08-08 15:28:09 (GMT)
commit540f62b18de23e912d85b8b0fe9ea4f35dda0d2b (patch)
treebfaea5c03c7fc848c1e05747d300c89b91112b05 /generic/tclExecute.c
parent79878e7af5ae502d353130a4cca867147152bfc2 (diff)
downloadtcl-540f62b18de23e912d85b8b0fe9ea4f35dda0d2b.zip
tcl-540f62b18de23e912d85b8b0fe9ea4f35dda0d2b.tar.gz
tcl-540f62b18de23e912d85b8b0fe9ea4f35dda0d2b.tar.bz2
Back-out 'foreacha' implementation but leave code cleanup of 'mapeach' and 'dict map'.
Diffstat (limited to 'generic/tclExecute.c')
-rw-r--r--generic/tclExecute.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 952eb32..e402634 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -5492,15 +5492,7 @@ TEBCresume(
opnd, i, O2S(listPtr)), Tcl_GetObjResult(interp));
goto gotError;
}
-
- /* If the accumulator is the only variable then this list gets
- * just one iteration. Otherwise we must keep going until the
- * list is exhausted by non-accumulator loop vars */
- j = ((i == 0) && (iterNum > 0)
- && (infoPtr->collect == TCL_EACH_ACCUM));
- /* j is 1 if the accumulator is present but does not consume
- * an element, or 0 otherwise (consuming or not-present). */
- if ((numVars > j) && (listLen > (iterNum * (numVars - j) + j))) {
+ if (listLen > iterNum * numVars) {
continueLoop = 1;
}
listTmpIndex++;
@@ -5525,11 +5517,8 @@ TEBCresume(
listPtr = TclListObjCopy(NULL, listVarPtr->value.objPtr);
TclListObjGetElements(interp, listPtr, &listLen, &elements);
- /* Don't modify the accumulator except on the first iteration */
- j = ((i == 0) && (iterNum > 0)
- && (infoPtr->collect == TCL_EACH_ACCUM));
- valIndex = (iterNum * (numVars - j) + j);
- for (; j < numVars; j++) {
+ valIndex = (iterNum * numVars);
+ for (j = 0; j < numVars; j++) {
if (valIndex >= listLen) {
TclNewObj(valuePtr);
} else {