summaryrefslogtreecommitdiffstats
path: root/generic/tclCompCmds.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclCompCmds.c')
-rw-r--r--generic/tclCompCmds.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c
index 8981e65..2b6f84c 100644
--- a/generic/tclCompCmds.c
+++ b/generic/tclCompCmds.c
@@ -4197,19 +4197,8 @@ TclCompileSwitchCmd(
bytes = tokenPtr[1].start;
numBytes = tokenPtr[1].size;
- /* Smallest possible two-element list has 3 byte string rep */
- if (numBytes < 3) {
- return TCL_ERROR;
- }
-
- /*
- * A list can have at most one more element than the number
- * of runs of (potentially) element-separating white space.
- * And one less each if whitespace leads or trails.
- */
-
- maxLen = TclCountSpaceRuns(bytes, numBytes, NULL) + 1
- - TclIsSpaceProc(*bytes) - TclIsSpaceProc(bytes[numBytes-1]);
+ /* Allocate enough space to work in. */
+ maxLen = TclMaxListLength(bytes, numBytes, NULL);
if (maxLen < 2) {
return TCL_ERROR;
}