diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2018-12-18 20:01:12 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2018-12-18 20:01:12 (GMT) |
commit | b143bb3fdde4bf18cf2ba4f8d7167108cd3b827c (patch) | |
tree | de9ffb100de0c151e64e8719bef8a039b0c5e945 /generic/tclCmdIL.c | |
parent | 05a370b2d2edcc0726e154d8b1aa51d6a4667542 (diff) | |
download | tcl-b143bb3fdde4bf18cf2ba4f8d7167108cd3b827c.zip tcl-b143bb3fdde4bf18cf2ba4f8d7167108cd3b827c.tar.gz tcl-b143bb3fdde4bf18cf2ba4f8d7167108cd3b827c.tar.bz2 |
Internal minor optimization of TIP #502 implementation. No difference in any outcome.
Diffstat (limited to 'generic/tclCmdIL.c')
-rw-r--r-- | generic/tclCmdIL.c | 17 |
1 files changed, 8 insertions, 9 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]); } } |