Attachment "Tcl_SplitList.patch" to
ticket [1344747fff]
added by
nobody
2005-11-01 18:01:07.
--- head-tclUtil.c 2005-11-01 10:00:40.678472100 +0000
+++ patch-tclUtil.c 2005-11-01 10:05:48.295596900 +0000
@@ -429,15 +429,25 @@ Tcl_SplitList(interp, list, argcPtr, arg
* the list.
*/
- for (size = 1, l = list; *l != 0; l++) {
+ for (size = 2, l = list; *l != 0; l++) {
if (isspace(UCHAR(*l))) { /* INTL: ISO space. */
size++;
+ /* Consecutive space can only count as a single list delimiter */
+ while (1) {
+ char next = *(l + 1);
+ if (next == '\0') {
+ break;
+ }
+ ++l;
+ if (isspace(UCHAR(next))) {
+ continue;
+ }
+ break;
}
}
- size++; /* Leave space for final NULL pointer. */
+ length = l - list;
argv = (CONST char **) ckalloc((unsigned)
- ((size * sizeof(char *)) + (l - list) + 1));
- length = strlen(list);
+ ((size * sizeof(char *)) + length + 1));
for (i = 0, p = ((char *) argv) + size*sizeof(char *);
*list != 0; i++) {
CONST char *prevList = list;