about summary refs log tree commit diff
path: root/Src/Zle/complist.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2011-09-18 17:44:12 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2011-09-18 17:44:12 +0000
commit84f8330e0dc88d4115b367432fd7b430eb332c8e (patch)
tree5a2282b662c4d7f9116ac4f44065531bf4682de6 /Src/Zle/complist.c
parent1c2ff6852911c47b1386d72e781b465f140e77eb (diff)
downloadzsh-84f8330e0dc88d4115b367432fd7b430eb332c8e.tar.gz
zsh-84f8330e0dc88d4115b367432fd7b430eb332c8e.tar.xz
zsh-84f8330e0dc88d4115b367432fd7b430eb332c8e.zip
users/16375: initialise nrefs on each loop in match tests
Diffstat (limited to 'Src/Zle/complist.c')
-rw-r--r--Src/Zle/complist.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c
index c9c0c2dd4..bcf356179 100644
--- a/Src/Zle/complist.c
+++ b/Src/Zle/complist.c
@@ -849,9 +849,9 @@ putmatchcol(char *group, char *n)
 {
     Patcol pc;
 
-    nrefs = MAX_POS - 1;
+    for (pc = mcolors.pats; pc; pc = pc->next) {
+	nrefs = MAX_POS - 1;
 
-    for (pc = mcolors.pats; pc; pc = pc->next)
 	if ((!pc->prog || !group || pattry(pc->prog, group)) &&
 	    pattryrefs(pc->pat, n, -1, -1, 0, &nrefs, begpos, endpos)) {
 	    if (pc->cols[1]) {
@@ -863,6 +863,7 @@ putmatchcol(char *group, char *n)
 
 	    return 0;
 	}
+    }
 
     zcputs(group, COL_NO);
 
@@ -880,9 +881,9 @@ putfilecol(char *group, char *filename, mode_t m, int special)
     Patcol pc;
     int len;
 
-    nrefs = MAX_POS - 1;
+    for (pc = mcolors.pats; pc; pc = pc->next) {
+	nrefs = MAX_POS - 1;
 
-    for (pc = mcolors.pats; pc; pc = pc->next)
 	if ((!pc->prog || !group || pattry(pc->prog, group)) &&
 	    pattryrefs(pc->pat, filename, -1, -1, 0, &nrefs, begpos, endpos)) {
 	    if (pc->cols[1]) {
@@ -894,6 +895,7 @@ putfilecol(char *group, char *filename, mode_t m, int special)
 
 	    return 0;
 	}
+    }
 
     if (special != -1) {
 	colour = special;