diff options
author | dgp <dgp@users.sourceforge.net> | 2018-03-26 16:27:40 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2018-03-26 16:27:40 (GMT) |
commit | 1a73baff0989dad465da8fd91f32d537bf704367 (patch) | |
tree | 62bf411067be2437cf7200348256493a0c0a9dc0 /generic/tclCmdIL.c | |
parent | 05c789647adebac2a77a4910a46810e94cad3efe (diff) | |
download | tcl-1a73baff0989dad465da8fd91f32d537bf704367.zip tcl-1a73baff0989dad465da8fd91f32d537bf704367.tar.gz tcl-1a73baff0989dad465da8fd91f32d537bf704367.tar.bz2 |
Work in progress implementing TIP 505.
Diffstat (limited to 'generic/tclCmdIL.c')
-rw-r--r-- | generic/tclCmdIL.c | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index 3b2cb19..10fbd3f 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -2747,21 +2747,10 @@ Tcl_LreplaceObjCmd( if (first < 0) { first = 0; } - - /* - * Complain if the user asked for a start element that is greater than the - * list length. This won't ever trigger for the "end-*" case as that will - * be properly constrained by TclGetIntForIndex because we use listLen-1 - * (to allow for replacing the last elem). - */ - - if ((first >= listLen) && (listLen > 0)) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "list doesn't contain element %s", TclGetString(objv[2]))); - Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LREPLACE", "BADIDX", - NULL); - return TCL_ERROR; + if (first > listLen) { + first = listLen; } + if (last >= listLen) { last = listLen - 1; } |