diff options
| author | apnadkarni <apnmbx-wits@yahoo.com> | 2023-04-20 16:44:49 (GMT) |
|---|---|---|
| committer | apnadkarni <apnmbx-wits@yahoo.com> | 2023-04-20 16:44:49 (GMT) |
| commit | c091b78af60d2f2f46c162bed19465380cf8d4bf (patch) | |
| tree | 3ab02f5cab50084747b4510be3b04817076d5b37 /generic/tclCmdAH.c | |
| parent | e359627a3620dd5d90bb533fd3aef15586b1d8af (diff) | |
| download | tcl-c091b78af60d2f2f46c162bed19465380cf8d4bf.zip tcl-c091b78af60d2f2f46c162bed19465380cf8d4bf.tar.gz tcl-c091b78af60d2f2f46c162bed19465380cf8d4bf.tar.bz2 | |
Bugs [4ce858a049] (lrepeat), [f4d15772f1] (foreach), [6926a21840] (lmap).
Diffstat (limited to 'generic/tclCmdAH.c')
| -rw-r--r-- | generic/tclCmdAH.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c index b2b1a61..e2186ed 100644 --- a/generic/tclCmdAH.c +++ b/generic/tclCmdAH.c @@ -27,9 +27,9 @@ struct ForeachState { Tcl_Obj *bodyPtr; /* The script body of the command. */ - int bodyIdx; /* The argument index of the body. */ - int j, maxj; /* Number of loop iterations. */ - int numLists; /* Count of value lists. */ + Tcl_Size bodyIdx; /* The argument index of the body. */ + Tcl_Size j, maxj; /* Number of loop iterations. */ + Tcl_Size numLists; /* Count of value lists. */ Tcl_Size *index; /* Array of value list indices. */ Tcl_Size *varcList; /* # loop variables per list. */ Tcl_Obj ***varvList; /* Array of var name lists. */ @@ -2733,7 +2733,8 @@ EachloopCmd( { int numLists = (objc-2) / 2; struct ForeachState *statePtr; - int i, j, result; + int i, result; + Tcl_Size j; if (objc < 4 || (objc%2 != 0)) { Tcl_WrongNumArgs(interp, 1, objv, @@ -2887,8 +2888,12 @@ ForeachLoopStep( break; case TCL_OK: if (statePtr->resultList != NULL) { - Tcl_ListObjAppendElement(interp, statePtr->resultList, - Tcl_GetObjResult(interp)); + result = Tcl_ListObjAppendElement( + interp, statePtr->resultList, Tcl_GetObjResult(interp)); + if (result != TCL_OK) { + /* e.g. memory alloc failure on big data tests */ + goto done; + } } break; case TCL_BREAK: |
