summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2002-01-03 18:23:47 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2002-01-03 18:23:47 (GMT)
commite9733d7e31787203d2e1ca47c8c05cc6669e2ad9 (patch)
tree4bea20379f2b8b069951068a3f9d76a1452a9309 /generic
parent4d95e01079a93133d207c23cd8ac9b6201bb557d (diff)
downloadtcl-e9733d7e31787203d2e1ca47c8c05cc6669e2ad9.zip
tcl-e9733d7e31787203d2e1ca47c8c05cc6669e2ad9.tar.gz
tcl-e9733d7e31787203d2e1ca47c8c05cc6669e2ad9.tar.bz2
Added fix for Bug #494348; the [foreach] implementation was doing some
cacheing that didn't seem to be safe, and which wouldn't gain very much performance either. Removing it fixed the bug.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclCmdAH.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c
index 1645ad3..489f370 100644
--- a/generic/tclCmdAH.c
+++ b/generic/tclCmdAH.c
@@ -11,7 +11,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.16 2001/09/20 01:03:08 hobbs Exp $
+ * RCS: @(#) $Id: tclCmdAH.c,v 1.17 2002/01/03 18:23:47 dkf Exp $
*/
#include "tclInt.h"
@@ -1730,24 +1730,23 @@ Tcl_ForeachObjCmd(dummy, interp, objc, objv)
for (j = 0; j < maxj; j++) {
for (i = 0; i < numLists; i++) {
/*
- * If a variable or value list object has been converted to
- * another kind of Tcl object, convert it back to a list object
- * and refetch the pointer to its element array.
+ * Refetch the list members; we assume that the sizes are
+ * the same, but the array of elements might be different
+ * if the internal rep of the objects has been lost and
+ * recreated (it is too difficult to accurately tell when
+ * this happens, which can lead to some wierd crashes,
+ * like Bug #494348...)
*/
- if (argObjv[1+i*2]->typePtr != &tclListType) {
- result = Tcl_ListObjGetElements(interp, argObjv[1+i*2],
- &varcList[i], &varvList[i]);
- if (result != TCL_OK) {
- panic("Tcl_ForeachObjCmd: could not reconvert variable list %d to a list object\n", i);
- }
+ result = Tcl_ListObjGetElements(interp, argObjv[1+i*2],
+ &varcList[i], &varvList[i]);
+ if (result != TCL_OK) {
+ panic("Tcl_ForeachObjCmd: could not reconvert variable list %d to a list object\n", i);
}
- if (argObjv[2+i*2]->typePtr != &tclListType) {
- result = Tcl_ListObjGetElements(interp, argObjv[2+i*2],
- &argcList[i], &argvList[i]);
- if (result != TCL_OK) {
- panic("Tcl_ForeachObjCmd: could not reconvert value list %d to a list object\n", i);
- }
+ result = Tcl_ListObjGetElements(interp, argObjv[2+i*2],
+ &argcList[i], &argvList[i]);
+ if (result != TCL_OK) {
+ panic("Tcl_ForeachObjCmd: could not reconvert value list %d to a list object\n", i);
}
for (v = 0; v < varcList[i]; v++) {