summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraspect <aspect+tclcore@abstracted-spleen.org>2017-05-22 10:47:36 (GMT)
committeraspect <aspect+tclcore@abstracted-spleen.org>2017-05-22 10:47:36 (GMT)
commit474b4da1ee1066623f5c11d122f7bfbe5daa25e0 (patch)
treea9aa7f90f2fbee6a626f482298471d6f3fed62ab
parentc6a2527af7f3b0c437c2206995a8d7462762bc48 (diff)
downloadtcl-474b4da1ee1066623f5c11d122f7bfbe5daa25e0.zip
tcl-474b4da1ee1066623f5c11d122f7bfbe5daa25e0.tar.gz
tcl-474b4da1ee1066623f5c11d122f7bfbe5daa25e0.tar.bz2
tidy up control flow
-rw-r--r--generic/tclUtil.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index d873a8a..f00b618 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -1940,9 +1940,9 @@ matchLoop:
goto matchFail;
} else {
str += TclUtfToUniChar(str, &sch);
+ ++pattern;
+ goto matchLoop;
}
- ++pattern;
- goto matchLoop;
case '*':
/*
@@ -2002,6 +2002,10 @@ matchLoop:
case '[':
++pattern;
+ /*
+ * Take the next char from input string to match
+ * against '[]' group
+ */
if(UCHAR(*str) < 0x80) {
sch = (Tcl_UniChar)
(nocase ? tolower(UCHAR(*str)) : UCHAR(*str));
@@ -2013,6 +2017,9 @@ matchLoop:
}
}
+ /*
+ * '[]' group loop: process single chars and a-z ranges
+ */
while (1) {
if (*pattern == ']') {
/*
@@ -2033,7 +2040,13 @@ matchLoop:
pch = Tcl_UniCharToLower(pch);
}
}
- if (*pattern == '-') {
+ if (*pattern != '-') {
+ /*
+ * Try to match a single char in '[]' group
+ */
+ if (pch == sch) break;
+ continue;
+ } else {
/*
* Start of a 'a-z' style range.
*/
@@ -2068,11 +2081,6 @@ matchLoop:
* on with the next part of '[]'
*/
continue;
- } else if (startChar == sch) {
- /*
- * Try to match a single char in '[]' group
- */
- break;
}
}
/*