about summary refs log tree commit diff
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:18 +0000
commita182afe2f2a8c76c533b199c7da0c8edc6ccc5a5 (patch)
tree21d013b1a9b8f571a9aeefb61810398956414410
parentf37fa9293fa128e657d4e124ac1aa25086f65847 (diff)
downloadzsh-a182afe2f2a8c76c533b199c7da0c8edc6ccc5a5.tar.gz
zsh-a182afe2f2a8c76c533b199c7da0c8edc6ccc5a5.tar.xz
zsh-a182afe2f2a8c76c533b199c7da0c8edc6ccc5a5.zip
39310/0009: internals: match_str: Downscope local variable 't'.
Remove needless initialization (it is written to again before it is ever read).

Note there was another 't' variable at the end of the function that shadowed
the int 't'.
-rw-r--r--ChangeLog3
-rw-r--r--Src/Zle/compmatch.c13
2 files changed, 14 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index f1d2c02d7..b839a4468 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2016-09-16  Daniel Shahaf  <d.s@daniel.shahaf.name>
 
+	* 39310/0009: Src/Zle/compmatch.c: internals: match_str:
+	Downscope local variable 't'.
+
 	* 39310/0008: Src/Zle/compmatch.c: internals: match_str:
 	Document several local variables.
 
diff --git a/Src/Zle/compmatch.c b/Src/Zle/compmatch.c
index 0c6270dee..fde7010a9 100644
--- a/Src/Zle/compmatch.c
+++ b/Src/Zle/compmatch.c
@@ -509,7 +509,6 @@ match_str(char *l, char *w, Brinfo *bpp, int bc, int *rwlp,
     int exact = 0, wexact = 0;
     int he = 0;
     int bslash;
-    int t;
     char *ow;
     Cmlist ms; /* loop variable */
     Cmatcher mp, lm = NULL;
@@ -594,7 +593,6 @@ match_str(char *l, char *w, Brinfo *bpp, int bc, int *rwlp,
 	/* First try the matchers. Err... see above. */
 	for (mp = NULL, ms = mstack; !mp && ms; ms = ms->next) {
 	    for (mp = ms->matcher; mp; mp = mp->next) {
-		t = 1;
 		if ((lm && lm == mp) ||
 		    ((original_ll == ll || original_lw == lw) &&
 		     (test == 1 || (test && !mp->left && !mp->right)) &&
@@ -604,6 +602,12 @@ match_str(char *l, char *w, Brinfo *bpp, int bc, int *rwlp,
 		    continue;
 
 		if (mp->wlen < 0) {
+		    /* `*'-pattern. */
+		    /*
+		     * Similar to the identically-named variable in the 'else'
+		     * block.
+		     */
+		    int t;
 		    /* 
 		     * 1 iff the anchor and the word are on the same side of
 		     * the line pattern; that is: if either
@@ -861,6 +865,11 @@ match_str(char *l, char *w, Brinfo *bpp, int bc, int *rwlp,
 		    break;
 		} else if (ll >= mp->llen && lw >= mp->wlen) {
 		    /* Non-`*'-pattern. */
+		    /*
+		     * Similar to the identically-named variable in the 'if'
+		     * block.
+		     */
+		    int t = 1;
 		    char *tl, *tw;
 		    int tll, tlw, til, tiw;