diff options
| author | twylite <twylite@crypt.co.za> | 2012-08-08 15:28:09 (GMT) |
|---|---|---|
| committer | twylite <twylite@crypt.co.za> | 2012-08-08 15:28:09 (GMT) |
| commit | 540f62b18de23e912d85b8b0fe9ea4f35dda0d2b (patch) | |
| tree | bfaea5c03c7fc848c1e05747d300c89b91112b05 /generic/tclExecute.c | |
| parent | 79878e7af5ae502d353130a4cca867147152bfc2 (diff) | |
| download | tcl-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.c | 17 |
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 { |
