diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-04-26 07:29:02 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-04-26 07:29:02 (GMT) |
| commit | a4c35fb82f99d990ca1ef877cb9917c7f55151ff (patch) | |
| tree | cdd02327448cf2c0393cbf3cea4fd48bb17e52c4 /generic/tclCmdIL.c | |
| parent | 81a213ed4ce77b15fbc6d5d97cc1235b689ad482 (diff) | |
| parent | e12b1646c6f675cf09d5f1a72d4ecdffa5da7396 (diff) | |
| download | tcl-a4c35fb82f99d990ca1ef877cb9917c7f55151ff.zip tcl-a4c35fb82f99d990ca1ef877cb9917c7f55151ff.tar.gz tcl-a4c35fb82f99d990ca1ef877cb9917c7f55151ff.tar.bz2 | |
Merge 8.7
Diffstat (limited to 'generic/tclCmdIL.c')
| -rw-r--r-- | generic/tclCmdIL.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index b9fc84a..986dd49 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -2731,8 +2731,8 @@ Tcl_LremoveObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - int i, idxc; - int listLen, *idxv, prevIdx, first, num; + int i, idxc, listLen, prevIdx, first, num; + int *idxv; Tcl_Obj *listObj; /* @@ -2960,7 +2960,8 @@ Tcl_LreplaceObjCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Obj *listPtr; - int first, last, listLen, numToDelete, result; + int first, last; + int listLen, numToDelete, result; if (objc < 4) { Tcl_WrongNumArgs(interp, 1, objv, @@ -2991,8 +2992,7 @@ Tcl_LreplaceObjCmd( if (first == TCL_INDEX_NONE) { first = 0; - } - if (first > listLen) { + } else if (first > listLen) { first = listLen; } @@ -3140,9 +3140,10 @@ Tcl_LsearchObjCmd( Tcl_Obj *const objv[]) /* Argument values. */ { const char *bytes, *patternBytes; - int i, match, index, result=TCL_OK, listc, length, elemLen, bisect; + int i, match, index, result=TCL_OK, listc, bisect; + int length, elemLen, start, groupSize, groupOffset, lower, upper; int allocatedIndexVector = 0; - int dataType, isIncreasing, lower, upper, start, groupSize, groupOffset; + int dataType, isIncreasing; Tcl_WideInt patWide, objWide; int allMatches, inlineReturn, negatedMatch, returnSubindices, noCase; double patDouble, objDouble; @@ -3514,7 +3515,7 @@ Tcl_LsearchObjCmd( if (allMatches || inlineReturn) { Tcl_ResetResult(interp); } else { - TclNewIntObj(itemPtr, TCL_INDEX_NONE); + TclNewIndexObj(itemPtr, TCL_INDEX_NONE); Tcl_SetObjResult(interp, itemPtr); } goto done; @@ -3645,7 +3646,7 @@ Tcl_LsearchObjCmd( * our first match might not be the first occurrence. * Consider: 0 0 0 1 1 1 2 2 2 * - * To maintain consistancy with standard lsearch semantics, we + * To maintain consistency with standard lsearch semantics, we * must find the leftmost occurrence of the pattern in the * list. Thus we don't just stop searching here. This * variation means that a search always makes log n @@ -3719,8 +3720,7 @@ Tcl_LsearchObjCmd( if (noCase) { match = (TclUtfCasecmp(bytes, patternBytes) == 0); } else { - match = (memcmp(bytes, patternBytes, - (size_t) length) == 0); + match = (memcmp(bytes, patternBytes, length) == 0); } } break; @@ -3804,10 +3804,10 @@ Tcl_LsearchObjCmd( } else if (returnSubindices) { int j; - TclNewIntObj(itemPtr, i+groupOffset); + TclNewIndexObj(itemPtr, i+groupOffset); for (j=0 ; j<sortInfo.indexc ; j++) { Tcl_Obj *elObj; - TclNewIntObj(elObj, TclIndexDecode(sortInfo.indexv[j], listc)); + TclNewIndexObj(elObj, TclIndexDecode(sortInfo.indexv[j], listc)); Tcl_ListObjAppendElement(interp, itemPtr, elObj); } Tcl_ListObjAppendElement(interp, listPtr, itemPtr); @@ -3827,16 +3827,16 @@ Tcl_LsearchObjCmd( if (returnSubindices) { int j; - TclNewIntObj(itemPtr, index+groupOffset); + TclNewIndexObj(itemPtr, index+groupOffset); for (j=0 ; j<sortInfo.indexc ; j++) { Tcl_Obj *elObj; - TclNewIntObj(elObj, TclIndexDecode(sortInfo.indexv[j], listc)); + TclNewIndexObj(elObj, TclIndexDecode(sortInfo.indexv[j], listc)); Tcl_ListObjAppendElement(interp, itemPtr, elObj); } Tcl_SetObjResult(interp, itemPtr); } else { Tcl_Obj *elObj; - TclNewIntObj(elObj, index); + TclNewIndexObj(elObj, index); Tcl_SetObjResult(interp, elObj); } } else if (index < 0) { @@ -4420,7 +4420,7 @@ Tcl_LsortObjCmd( idx = elementPtr->payload.index; for (j = 0; j < groupSize; j++) { if (indices) { - TclNewIntObj(objPtr, idx + j - groupOffset); + TclNewIndexObj(objPtr, idx + j - groupOffset); newArray[i++] = objPtr; Tcl_IncrRefCount(objPtr); } else { @@ -4432,7 +4432,7 @@ Tcl_LsortObjCmd( } } else if (indices) { for (i=0; elementPtr != NULL ; elementPtr = elementPtr->nextPtr) { - TclNewIntObj(objPtr, elementPtr->payload.index); + TclNewIndexObj(objPtr, elementPtr->payload.index); newArray[i++] = objPtr; Tcl_IncrRefCount(objPtr); } |
