summary refs log tree commit diff
path: root/Src/Zle/compmatch.c
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2016-09-14 03:38:35 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2016-09-16 03:54:19 +0000
commit2df02212b0528e7636ae9032536bdee4557fb690 (patch)
treee8931e9ed436c538c58bcd2898f2b200faa0fd94 /Src/Zle/compmatch.c
parenta182afe2f2a8c76c533b199c7da0c8edc6ccc5a5 (diff)
downloadzsh-2df02212b0528e7636ae9032536bdee4557fb690.tar.gz
zsh-2df02212b0528e7636ae9032536bdee4557fb690.tar.xz
zsh-2df02212b0528e7636ae9032536bdee4557fb690.zip
39310/0010: internals: match_str: Simplify expression.
In the first hunk we actually know that ind==0 since sfx==0, but keep it identical
to the last hunk.

Also add a comment (unrelated).
Diffstat (limited to 'Src/Zle/compmatch.c')
-rw-r--r--Src/Zle/compmatch.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/Src/Zle/compmatch.c b/Src/Zle/compmatch.c
index fde7010a9..f82f00e1d 100644
--- a/Src/Zle/compmatch.c
+++ b/Src/Zle/compmatch.c
@@ -569,8 +569,7 @@ match_str(char *l, char *w, Brinfo *bpp, int bc, int *rwlp,
 	bslash = 0;
 	if (!sfx && lw && (!part || test) &&
 	    (l[ind] == w[ind] ||
-	     (bslash = (lw > 1 && w[ind] == '\\' &&
-			(ind ? (w[0] == l[0]) : (w[1] == l[0])))))) {
+	     (bslash = (lw > 1 && w[ind] == '\\' && w[ind+1] == l[0])))) {
 	    /* No matcher could be used, but the strings have the same
 	     * character here, skip over it. */
 	    l += add; w += (bslash ? (add + add) : add);
@@ -855,8 +854,10 @@ match_str(char *l, char *w, Brinfo *bpp, int bc, int *rwlp,
 
 		    if (!llen && !alen) {
 			lm = mp;
-			if (he)
+			if (he) {
+			    /* Signal the outer for loop to continue. */
 			    mp = NULL;
+			}
 			else
 			    he = 1;
 		    } else {
@@ -996,8 +997,7 @@ match_str(char *l, char *w, Brinfo *bpp, int bc, int *rwlp,
 	bslash = 0;
 	if ((!test || sfx) && lw &&
 	    (l[ind] == w[ind] ||
-	     (bslash = (lw > 1 && w[ind] == '\\' &&
-			(ind ? (w[0] == l[0]) : (w[1] == l[0])))))) {
+	     (bslash = (lw > 1 && w[ind] == '\\' && w[ind+1] == l[0])))) {
 	    /* No matcher could be used, but the strings have the same
 	     * character here, skip over it. */
 	    l += add; w += (bslash ? (add + add ) : add);