diff options
| -rw-r--r-- | generic/tclCmdIL.c | 17 | ||||
| -rw-r--r-- | generic/tclCompCmdsSZ.c | 12 |
2 files changed, 14 insertions, 15 deletions
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index dd11bac..03867b2 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -2606,7 +2606,7 @@ Tcl_LpopObjCmd( * First, extract the element to be returned. * TclLindexFlat adds a ref count which is handled. */ - + if (objc == 2) { elemPtr = elemPtrs[listLen - 1]; Tcl_IncrRefCount(elemPtr); @@ -2639,7 +2639,7 @@ Tcl_LpopObjCmd( return TCL_ERROR; } } - + listPtr = Tcl_ObjSetVar2(interp, objv[1], NULL, listPtr, TCL_LEAVE_ERR_MSG); if (listPtr == NULL) { return TCL_ERROR; @@ -3240,11 +3240,10 @@ Tcl_LsearchObjCmd( for (j=0 ; j<sortInfo.indexc ; j++) { int encoded = 0; if (TclIndexEncode(interp, indices[j], TCL_INDEX_BEFORE, - TCL_INDEX_AFTER, &encoded) != TCL_OK) { + TCL_INDEX_BEFORE, &encoded) != TCL_OK) { result = TCL_ERROR; } - if ((encoded == TCL_INDEX_BEFORE) - || (encoded == TCL_INDEX_AFTER)) { + if (encoded == TCL_INDEX_BEFORE) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "index \"%s\" cannot select an element " "from any list", Tcl_GetString(indices[j]))); @@ -3959,10 +3958,9 @@ Tcl_LsortObjCmd( for (j=0 ; j<indexc ; j++) { int encoded = 0; int result = TclIndexEncode(interp, indexv[j], - TCL_INDEX_BEFORE, TCL_INDEX_AFTER, &encoded); + TCL_INDEX_BEFORE, TCL_INDEX_BEFORE, &encoded); - if ((result == TCL_OK) && ((encoded == TCL_INDEX_BEFORE) - || (encoded == TCL_INDEX_AFTER))) { + if ((result == TCL_OK) && (encoded == TCL_INDEX_BEFORE)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "index \"%s\" cannot select an element " "from any list", Tcl_GetString(indexv[j]))); @@ -4051,7 +4049,8 @@ Tcl_LsortObjCmd( } for (j=0 ; j<sortInfo.indexc ; j++) { /* Prescreened values, no errors or out of range possible */ - TclIndexEncode(NULL, indexv[j], 0, 0, &sortInfo.indexv[j]); + TclIndexEncode(NULL, indexv[j], TCL_INDEX_BEFORE, + TCL_INDEX_BEFORE, &sortInfo.indexv[j]); } } diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index 8b54a99..557340c 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -1020,7 +1020,7 @@ TclCompileStringReplaceCmd( * Check for first index known and useful at compile time. */ tokenPtr = TokenAfter(valueTokenPtr); - if (TclGetIndexFromToken(tokenPtr, TCL_INDEX_BEFORE, TCL_INDEX_AFTER, + if (TclGetIndexFromToken(tokenPtr, TCL_INDEX_START, TCL_INDEX_AFTER, &first) != TCL_OK) { goto genericReplace; } @@ -1029,7 +1029,7 @@ TclCompileStringReplaceCmd( * Check for last index known and useful at compile time. */ tokenPtr = TokenAfter(tokenPtr); - if (TclGetIndexFromToken(tokenPtr, TCL_INDEX_BEFORE, TCL_INDEX_AFTER, + if (TclGetIndexFromToken(tokenPtr, TCL_INDEX_BEFORE, TCL_INDEX_END, &last) != TCL_OK) { goto genericReplace; } @@ -1125,7 +1125,7 @@ TclCompileStringReplaceCmd( * though, interfere with getting a guarantee that first <= last. */ - if ((first == TCL_INDEX_BEFORE) && (last >= TCL_INDEX_START)) { + if ((first == TCL_INDEX_START) && (last >= TCL_INDEX_START)) { /* empty prefix */ tokenPtr = TokenAfter(tokenPtr); CompileWord(envPtr, tokenPtr, interp, 4); @@ -1156,10 +1156,10 @@ TclCompileStringReplaceCmd( * are harmless when they are replaced by another empty string. */ - if ((first == TCL_INDEX_BEFORE) || (first == TCL_INDEX_START)) { + if (first == TCL_INDEX_START) { /* empty prefix - build suffix only */ - if ((last == TCL_INDEX_END) || (last == TCL_INDEX_AFTER)) { + if (last == TCL_INDEX_END) { /* empty suffix too => empty result */ OP( POP); /* Pop original */ PUSH ( ""); @@ -1168,7 +1168,7 @@ TclCompileStringReplaceCmd( OP44( STR_RANGE_IMM, last + 1, TCL_INDEX_END); return TCL_OK; } else { - if ((last == TCL_INDEX_END) || (last == TCL_INDEX_AFTER)) { + if (last == TCL_INDEX_END) { /* empty suffix - build prefix only */ OP44( STR_RANGE_IMM, 0, first-1); return TCL_OK; |
