diff options
| author | dgp@users.sourceforge.net <dgp> | 2011-05-02 15:52:52 (GMT) |
|---|---|---|
| committer | dgp@users.sourceforge.net <dgp> | 2011-05-02 15:52:52 (GMT) |
| commit | abceefc636b4d89395d41f4ab72d0388ce3d470c (patch) | |
| tree | 4fbdd48b0a1d19dee6790635c014578c8f79a05c /generic/tclCompCmds.c | |
| parent | 1610e268509d497c2af3c99f9b6ee0b7ab539ab4 (diff) | |
| parent | eb7f3c27b70a4214dd88dbdd04f3a3a982f09901 (diff) | |
| download | tcl-abceefc636b4d89395d41f4ab72d0388ce3d470c.zip tcl-abceefc636b4d89395d41f4ab72d0388ce3d470c.tar.gz tcl-abceefc636b4d89395d41f4ab72d0388ce3d470c.tar.bz2 | |
Replace TclCountSpaceRuns() with TclMaxListLength() which is the function we
actually want.
Diffstat (limited to 'generic/tclCompCmds.c')
| -rw-r--r-- | generic/tclCompCmds.c | 15 |
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; } |
