diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-01-17 11:21:08 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-01-17 11:21:08 (GMT) |
commit | 92c6a7008144e86f2fb207c03aadae1fd767f678 (patch) | |
tree | e6e36b64f9a7fedb6b4879c510117687386e500c /generic/tclExecute.c | |
parent | 2f374ff67ee30bcc15752b48e36729c583615a12 (diff) | |
parent | e5a2ebd71b2aa2b31ca5128eb47ae0a7fdd20bd5 (diff) | |
download | tcl-92c6a7008144e86f2fb207c03aadae1fd767f678.zip tcl-92c6a7008144e86f2fb207c03aadae1fd767f678.tar.gz tcl-92c6a7008144e86f2fb207c03aadae1fd767f678.tar.bz2 |
Merge 8.6
Diffstat (limited to 'generic/tclExecute.c')
-rw-r--r-- | generic/tclExecute.c | 54 |
1 files changed, 13 insertions, 41 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c index d03f1cb..8301627 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -5370,17 +5370,7 @@ TEBCresume( } CACHE_STACK_INFO(); - if (fromIdx < 0) { - fromIdx = 0; - } - if (toIdx >= length) { - toIdx = length; - } - if (toIdx >= fromIdx) { - objResultPtr = Tcl_GetRange(OBJ_AT_DEPTH(2), fromIdx, toIdx); - } else { - TclNewObj(objResultPtr); - } + objResultPtr = Tcl_GetRange(OBJ_AT_DEPTH(2), fromIdx, toIdx); TRACE_APPEND(("\"%.30s\"\n", O2S(objResultPtr))); NEXT_INST_V(1, 3, 1); @@ -5405,37 +5395,19 @@ TEBCresume( * Extra safety for legacy bytecodes: */ if (toIdx == TCL_INDEX_NONE) { - goto emptyRange; - } - - toIdx = TclIndexDecode(toIdx, length - 1); - if (toIdx < 0) { - goto emptyRange; - } else if (toIdx >= length) { - toIdx = length - 1; - } - - assert ( toIdx >= 0 && toIdx < length ); - - /* - assert ( fromIdx != TCL_INDEX_NONE ); - * - * Extra safety for legacy bytecodes: - */ - if (fromIdx == TCL_INDEX_NONE) { - fromIdx = TCL_INDEX_START; - } - - fromIdx = TclIndexDecode(fromIdx, length - 1); - if (fromIdx < 0) { - fromIdx = 0; - } - - if (fromIdx <= toIdx) { - objResultPtr = Tcl_GetRange(valuePtr, fromIdx, toIdx); - } else { - emptyRange: TclNewObj(objResultPtr); + } else { + toIdx = TclIndexDecode(toIdx, length - 1); + /* + assert ( fromIdx != TCL_INDEX_NONE ); + * + * Extra safety for legacy bytecodes: + */ + if (fromIdx == TCL_INDEX_NONE) { + fromIdx = TCL_INDEX_START; + } + fromIdx = TclIndexDecode(fromIdx, length - 1); + objResultPtr = Tcl_GetRange(valuePtr, fromIdx, toIdx); } TRACE_APPEND(("%.30s\n", O2S(objResultPtr))); NEXT_INST_F(9, 1, 1); |