summaryrefslogtreecommitdiffstats
path: root/generic/tclCompCmds.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-05-13 15:23:08 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-05-13 15:23:08 (GMT)
commit683756c1bdcc1745f0953b26f798154e1fdff5a1 (patch)
tree09b6a976eb8712446f41b0438c85a03a25cd7f3a /generic/tclCompCmds.c
parent137310bc48c268ffa2c880ec847258e394e1475c (diff)
downloadtcl-683756c1bdcc1745f0953b26f798154e1fdff5a1.zip
tcl-683756c1bdcc1745f0953b26f798154e1fdff5a1.tar.gz
tcl-683756c1bdcc1745f0953b26f798154e1fdff5a1.tar.bz2
In some places, Tcl_UtfPrev()/Tcl_UtfNext() is used traversing the individual bytes of a string searching for '(', ')', '::' or other single bytes. It is overkill to use Tcl_UtfPrev/Tcl_UtfNext for that, since those characters can only appear as their ASCII byte, not as any other sequence.
Diffstat (limited to 'generic/tclCompCmds.c')
-rw-r--r--generic/tclCompCmds.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c
index d8f0aeb..fa192ef 100644
--- a/generic/tclCompCmds.c
+++ b/generic/tclCompCmds.c
@@ -3441,10 +3441,10 @@ TclPushVarName(
/*
* last char is ')' => potential array reference.
*/
- last = Tcl_UtfPrev(name + nameLen, name);
+ last = &name[nameLen-1];
if (*last == ')') {
- for (p = name; p < last; p = Tcl_UtfNext(p)) {
+ for (p = name; p < last; p++) {
if (*p == '(') {
elName = p + 1;
elNameLen = last - elName;
@@ -3472,15 +3472,14 @@ TclPushVarName(
} else if (interp && ((n = varTokenPtr->numComponents) > 1)
&& (varTokenPtr[1].type == TCL_TOKEN_TEXT)
&& (varTokenPtr[n].type == TCL_TOKEN_TEXT)
- && (*((p = varTokenPtr[n].start + varTokenPtr[n].size)-1) == ')')
- && (*Tcl_UtfPrev(p, varTokenPtr[n].start) == ')')) {
+ && (*(varTokenPtr[n].start + varTokenPtr[n].size - 1) == ')')) {
/*
* Check for parentheses inside first token.
*/
simpleVarName = 0;
for (p = varTokenPtr[1].start,
- last = p + varTokenPtr[1].size; p < last; p = Tcl_UtfNext(p)) {
+ last = p + varTokenPtr[1].size; p < last; p++) {
if (*p == '(') {
simpleVarName = 1;
break;
@@ -3548,7 +3547,7 @@ TclPushVarName(
int hasNsQualifiers = 0;
- for (p = name, last = p + nameLen-1; p < last; p = Tcl_UtfNext(p)) {
+ for (p = name, last = p + nameLen-1; p < last; p++) {
if ((*p == ':') && (*(p+1) == ':')) {
hasNsQualifiers = 1;
break;