From 2df02212b0528e7636ae9032536bdee4557fb690 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Wed, 14 Sep 2016 03:38:35 +0000 Subject: 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). --- ChangeLog | 3 +++ Src/Zle/compmatch.c | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index b839a4468..87b766b10 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-09-16 Daniel Shahaf + * 39310/0010: Src/Zle/compmatch.c: internals: match_str: + Simplify expression. + * 39310/0009: Src/Zle/compmatch.c: internals: match_str: Downscope local variable 't'. 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); -- cgit 1.4.1