summaryrefslogtreecommitdiffstats
path: root/generic/tclCompCmds.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2014-12-18 22:13:11 (GMT)
committerdgp <dgp@users.sourceforge.net>2014-12-18 22:13:11 (GMT)
commitaed72bee30f449ec04643ceb42df9d45b635892e (patch)
treebfcfa85f881682b2a3e69435a8fa3b4c4aa508be /generic/tclCompCmds.c
parentf65cb994d8c1ae7358d383f10c983758eb59fdf0 (diff)
downloadtcl-aed72bee30f449ec04643ceb42df9d45b635892e.zip
tcl-aed72bee30f449ec04643ceb42df9d45b635892e.tar.gz
tcl-aed72bee30f449ec04643ceb42df9d45b635892e.tar.bz2
No need for a loopIndex.
Diffstat (limited to 'generic/tclCompCmds.c')
-rw-r--r--generic/tclCompCmds.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c
index 1bafbe2..0030f62 100644
--- a/generic/tclCompCmds.c
+++ b/generic/tclCompCmds.c
@@ -1543,7 +1543,7 @@ TclCompileForeachCmd(
unsigned char *jumpPc;
JumpFixup jumpFalseFixup;
int jumpBackDist, jumpBackOffset, infoIndex, range;
- int numWords, numLists, numVars, loopIndex, tempVar, i, j, code = TCL_OK;
+ int numWords, numLists, numVars, tempVar, i, j, code = TCL_OK;
int savedStackDepth = envPtr->currStackDepth;
Tcl_Obj *varListObj = NULL;
DefineLineInformation; /* TIP #280 */
@@ -1592,7 +1592,6 @@ TclCompileForeachCmd(
* a scalar, or if any var list needs substitutions.
*/
- loopIndex = 0;
varListObj = Tcl_NewObj();
for (i = 0, tokenPtr = parsePtr->tokenPtr;
i < numWords-1;
@@ -1619,7 +1618,7 @@ TclCompileForeachCmd(
varListPtr = (ForeachVarList *) ckalloc((unsigned)
sizeof(ForeachVarList) + numVars*sizeof(int));
varListPtr->numVars = numVars;
- infoPtr->varLists[loopIndex] = varListPtr;
+ infoPtr->varLists[i/2] = varListPtr;
infoPtr->numLists++;
for (j = 0; j < numVars; j++) {
@@ -1641,7 +1640,6 @@ TclCompileForeachCmd(
}
Tcl_SetObjLength(varListObj, 0);
- loopIndex++;
}
/*
@@ -1656,7 +1654,7 @@ TclCompileForeachCmd(
tempVar = TclFindCompiledLocal(NULL, 0, 1, procPtr);
infoPtr->firstValueTemp = tempVar;
- for (loopIndex = 1; loopIndex < numLists; loopIndex++) {
+ for (i= 1; i < numLists; i++) {
TclFindCompiledLocal(NULL, 0, 1, procPtr);
}
infoPtr->loopCtTemp = TclFindCompiledLocal(NULL, 0, 1, procPtr);
@@ -1673,7 +1671,6 @@ TclCompileForeachCmd(
* Evaluate then store each value list in the associated temporary.
*/
- loopIndex = 0;
for (i = 0, tokenPtr = parsePtr->tokenPtr;
i < numWords-1;
i++, tokenPtr = TokenAfter(tokenPtr)) {
@@ -1686,7 +1683,7 @@ TclCompileForeachCmd(
TclEmitInstInt4(INST_STORE_SCALAR4, tempVar, envPtr);
}
TclEmitOpcode(INST_POP, envPtr);
- loopIndex++; tempVar++;
+ tempVar++;
}
}