summaryrefslogtreecommitdiffstats
path: root/generic/tclCmdAH.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclCmdAH.c')
-rw-r--r--generic/tclCmdAH.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c
index ea0b772..0a24d88 100644
--- a/generic/tclCmdAH.c
+++ b/generic/tclCmdAH.c
@@ -2356,8 +2356,6 @@ StoreStatData(
}
/*
- * Assume Tcl_ObjSetVar2() does not keep a copy of the field name!
- *
* Might be a better idea to call Tcl_SetVar2Ex() instead, except we want
* to have an object (i.e. possibly cached) array variable name but a
* string element name, so no API exists. Messy.
@@ -2784,13 +2782,18 @@ EachloopCmd(
for (i=0 ; i<numLists ; i++) {
/* List */
/* Variables */
- statePtr->vCopyList[i] = TclListObjCopy(interp, objv[1+i*2]);
- if (statePtr->vCopyList[i] == NULL) {
+ statePtr->vCopyList[i] = TclDuplicatePureObj(
+ interp, objv[1+i*2], &tclListType.objType);
+ if (!statePtr->vCopyList[i]) {
result = TCL_ERROR;
goto done;
}
- TclListObjLengthM(NULL, statePtr->vCopyList[i],
+ result = TclListObjLengthM(interp, statePtr->vCopyList[i],
&statePtr->varcList[i]);
+ if (result != TCL_OK) {
+ result = TCL_ERROR;
+ goto done;
+ }
if (statePtr->varcList[i] < 1) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"%s varlist is empty",
@@ -2816,13 +2819,17 @@ EachloopCmd(
statePtr->argcList[i] = ABSTRACTLIST_PROC(statePtr->aCopyList[i], lengthProc)(statePtr->aCopyList[i]);
} else {
/* List values */
- statePtr->aCopyList[i] = TclListObjCopy(interp, objv[2+i*2]);
- if (statePtr->aCopyList[i] == NULL) {
+ statePtr->aCopyList[i] = TclDuplicatePureObj(
+ interp, objv[2+i*2], &tclListType.objType);
+ if (!statePtr->aCopyList[i]) {
result = TCL_ERROR;
goto done;
}
- TclListObjGetElementsM(NULL, statePtr->aCopyList[i],
+ result = TclListObjGetElementsM(interp, statePtr->aCopyList[i],
&statePtr->argcList[i], &statePtr->argvList[i]);
+ if (result != TCL_OK) {
+ goto done;
+ }
}
/* account for variable <> value mismatch */
j = statePtr->argcList[i] / statePtr->varcList[i];