summaryrefslogtreecommitdiffstats
path: root/generic/tclCompCmds.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2011-05-02 15:52:52 (GMT)
committerdgp <dgp@users.sourceforge.net>2011-05-02 15:52:52 (GMT)
commit947276586182ac00478069deedd6c81310e6d783 (patch)
tree4fbdd48b0a1d19dee6790635c014578c8f79a05c /generic/tclCompCmds.c
parentae77402981ca9e7f6265c7b98206c31f6050e8e7 (diff)
parentef87219015417dcab0f3aae83834c2c00cdb5607 (diff)
downloadtcl-947276586182ac00478069deedd6c81310e6d783.zip
tcl-947276586182ac00478069deedd6c81310e6d783.tar.gz
tcl-947276586182ac00478069deedd6c81310e6d783.tar.bz2
Replace TclCountSpaceRuns() with TclMaxListLength() which is the function we
actually want.
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;
}