summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2007-02-26 19:10:30 (GMT)
committerdgp <dgp@users.sourceforge.net>2007-02-26 19:10:30 (GMT)
commit1f1d5fbf52282c44556d4e7c81ce8814c7fe6035 (patch)
treeea0f8263748921699094f08840c6b36d03181ae5
parentf3533a9258ecec84b776d21653f7d91abdf67831 (diff)
downloadtcl-1f1d5fbf52282c44556d4e7c81ce8814c7fe6035.zip
tcl-1f1d5fbf52282c44556d4e7c81ce8814c7fe6035.tar.gz
tcl-1f1d5fbf52282c44556d4e7c81ce8814c7fe6035.tar.bz2
* generic/tclCmdAH.c (Tcl_ForeachObjCmd): Removed surplus copying
of the objv array that used to be a workaround for Bug 404865. That bug is long fixed.
-rw-r--r--ChangeLog6
-rw-r--r--generic/tclCmdAH.c39
2 files changed, 12 insertions, 33 deletions
diff --git a/ChangeLog b/ChangeLog
index 6fda366..427c246 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-02-26 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tclCmdAH.c (Tcl_ForeachObjCmd): Removed surplus copying
+ of the objv array that used to be a workaround for Bug 404865. That bug
+ is long fixed.
+
2007-02-24 Don Porter <dgp@users.sourceforge.net>
* generic/tclBasic.c: Use new interface in Tcl_EvalObjEx so that
diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c
index 79577e0..a179357 100644
--- a/generic/tclCmdAH.c
+++ b/generic/tclCmdAH.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCmdAH.c,v 1.82 2007/02/06 21:15:14 dkf Exp $
+ * RCS: @(#) $Id: tclCmdAH.c,v 1.83 2007/02/26 19:10:32 dgp Exp $
*/
#include "tclInt.h"
@@ -1699,17 +1699,6 @@ Tcl_ForeachObjCmd(
int numLists; /* Count of value lists */
Tcl_Obj *bodyPtr;
- /*
- * We copy the argument object pointers into a local array to avoid the
- * problem that "objv" might become invalid. It is a pointer into the
- * evaluation stack and that stack might be grown and reallocated if the
- * loop body requires a large amount of stack space.
- */
-
-#define NUM_ARGS 9
- Tcl_Obj *(argObjStorage[NUM_ARGS]);
- Tcl_Obj **argObjv = argObjStorage;
-
#define STATIC_LIST_SIZE 4
int indexArray[STATIC_LIST_SIZE];
int varcListArray[STATIC_LIST_SIZE];
@@ -1731,18 +1720,6 @@ Tcl_ForeachObjCmd(
}
/*
- * Create the object argument array "argObjv". Make sure argObjv is large
- * enough to hold the objc arguments.
- */
-
- if (objc > NUM_ARGS) {
- argObjv = (Tcl_Obj **) ckalloc(objc * sizeof(Tcl_Obj *));
- }
- for (i=0 ; i<objc ; i++) {
- argObjv[i] = objv[i];
- }
-
- /*
* Manage numList parallel value lists.
* argvList[i] is a value list counted by argcList[i]l;
* varvList[i] is the list of variables associated with the value list;
@@ -1772,7 +1749,7 @@ Tcl_ForeachObjCmd(
maxj = 0;
for (i=0 ; i<numLists ; i++) {
- result = Tcl_ListObjGetElements(interp, argObjv[1+i*2],
+ result = Tcl_ListObjGetElements(interp, objv[1+i*2],
&varcList[i], &varvList[i]);
if (result != TCL_OK) {
goto done;
@@ -1783,7 +1760,7 @@ Tcl_ForeachObjCmd(
goto done;
}
- result = Tcl_ListObjGetElements(interp, argObjv[2+i*2],
+ result = Tcl_ListObjGetElements(interp, objv[2+i*2],
&argcList[i], &argvList[i]);
if (result != TCL_OK) {
goto done;
@@ -1803,7 +1780,7 @@ Tcl_ForeachObjCmd(
* run out of values, set loop vars to ""
*/
- bodyPtr = argObjv[objc-1];
+ bodyPtr = objv[objc-1];
for (j=0 ; j<maxj ; j++) {
for (i=0 ; i<numLists ; i++) {
/*
@@ -1814,12 +1791,12 @@ Tcl_ForeachObjCmd(
* lead to some wierd crashes, like Bug #494348...)
*/
- result = Tcl_ListObjGetElements(interp, argObjv[1+i*2],
+ result = Tcl_ListObjGetElements(interp, objv[1+i*2],
&varcList[i], &varvList[i]);
if (result != TCL_OK) {
Tcl_Panic("Tcl_ForeachObjCmd: could not reconvert variable list %d to a list object", i);
}
- result = Tcl_ListObjGetElements(interp, argObjv[2+i*2],
+ result = Tcl_ListObjGetElements(interp, objv[2+i*2],
&argcList[i], &argvList[i]);
if (result != TCL_OK) {
Tcl_Panic("Tcl_ForeachObjCmd: could not reconvert value list %d to a list object", i);
@@ -1879,12 +1856,8 @@ Tcl_ForeachObjCmd(
ckfree((char *) varvList);
ckfree((char *) argvList);
}
- if (argObjv != argObjStorage) {
- ckfree((char *) argObjv);
- }
return result;
#undef STATIC_LIST_SIZE
-#undef NUM_ARGS
}
/*