summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--Src/parse.c6
2 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index b3e702cd1..ab99306be 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2017-07-09  Peter Stephenson  <p.w.stephenson@ntlworld.com>
 
+	* Sebastian: 41402: Src/parse.c: Delay checking tokens in
+	ecstrcode() as may not be needed.
+
 	* Sebastian: 41402: Src/parse.c, Src/zsh.h: Add hasher to
 	ecstrcode() to reduce string comparisons.
 
diff --git a/Src/parse.c b/Src/parse.c
index 00a8f6a5a..ba9cd61eb 100644
--- a/Src/parse.c
+++ b/Src/parse.c
@@ -394,11 +394,12 @@ ecdel(int p)
 static wordcode
 ecstrcode(char *s)
 {
-    int l, t = has_token(s);
+    int l, t;
 
     unsigned val = hasher(s);
 
     if ((l = strlen(s) + 1) && l <= 4) {
+	t = has_token(s);
 	wordcode c = (t ? 3 : 2);
 	switch (l) {
 	case 4: c |= ((wordcode) STOUC(s[2])) << 19;
@@ -417,6 +418,9 @@ ecstrcode(char *s)
             }
 	    pp = (cmp < 0 ? &(p->left) : &(p->right));
 	}
+
+        t = has_token(s);
+
 	p = *pp = (Eccstr) zhalloc(sizeof(*p));
 	p->left = p->right = 0;
 	p->offs = ((ecsoffs - ecssub) << 2) | (t ? 1 : 0);