diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-11-28 23:16:31 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-11-28 23:16:31 (GMT) |
commit | 71b0ad990caaf6a297049da2c63821a4e29c57ac (patch) | |
tree | f27faff96ed68e42d4c00da3a522f9eef06a2528 /generic/tclCmdMZ.c | |
parent | da196c33450ded41b2370bf956f7d3cd7b081069 (diff) | |
download | tcl-71b0ad990caaf6a297049da2c63821a4e29c57ac.zip tcl-71b0ad990caaf6a297049da2c63821a4e29c57ac.tar.gz tcl-71b0ad990caaf6a297049da2c63821a4e29c57ac.tar.bz2 |
Reduce shimmering: If a conclusion can be drawn about the number of list elements, don't get the elements before the list length is checked
Diffstat (limited to 'generic/tclCmdMZ.c')
-rw-r--r-- | generic/tclCmdMZ.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 57541f9..147c2dc 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -3610,7 +3610,7 @@ TclNRSwitchObjCmd( Tcl_Obj **listv; blist = objv[0]; - if (TclListObjGetElementsM(interp, objv[0], &objc, &listv) != TCL_OK) { + if (TclListObjLengthM(interp, objv[0], &objc) != TCL_OK) { return TCL_ERROR; } @@ -3623,6 +3623,9 @@ TclNRSwitchObjCmd( "?-option ...? string {?pattern body ...? ?default body?}"); return TCL_ERROR; } + if (TclListObjGetElementsM(interp, objv[0], &objc, &listv) != TCL_OK) { + return TCL_ERROR; + } objv = listv; splitObjs = 1; } |