about summary refs log tree commit diff
path: root/Src/glob.c
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2014-06-05 21:10:23 -0700
committerBarton E. Schaefer <schaefer@zsh.org>2014-06-05 21:10:23 -0700
commit32756f78afc81bdc42b47c7bdb522c582b9d896a (patch)
treeae9a4458c2fc45fd3e3c68e55f2cce89e03ec148 /Src/glob.c
parentc41287b318da8849ea61cf712a303f0a84da56dd (diff)
downloadzsh-32756f78afc81bdc42b47c7bdb522c582b9d896a.tar.gz
zsh-32756f78afc81bdc42b47c7bdb522c582b9d896a.tar.xz
zsh-32756f78afc81bdc42b47c7bdb522c582b9d896a.zip
32723: add braces around some if/else branches
Diffstat (limited to 'Src/glob.c')
-rw-r--r--Src/glob.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/Src/glob.c b/Src/glob.c
index c6cb3d2fc..15a5f70b7 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -462,18 +462,19 @@ scanner(Complist q, int shortcircuit)
     int errssofar = errsfound;
     struct dirsav ds;
 
-    init_dirsav(&ds);
     if (!q)
 	return;
+    init_dirsav(&ds);
 
     if ((closure = q->closure)) {
 	/* (foo/)# - match zero or more dirs */
 	if (q->closure == 2)	/* (foo/)## - match one or more dirs */
 	    q->closure = 1;
-	else
+	else {
 	    scanner(q->next, shortcircuit);
 	    if (shortcircuit && shortcircuit == matchct)
 		return;
+	}
     }
     p = q->pat;
     /* Now the actual matching for the current path section. */
@@ -518,10 +519,11 @@ scanner(Complist q, int shortcircuit)
 		}
 		if (add) {
 		    addpath(str, l);
-		    if (!closure || !statfullpath("", NULL, 1))
+		    if (!closure || !statfullpath("", NULL, 1)) {
 			scanner((q->closure) ? q : q->next, shortcircuit);
 			if (shortcircuit && shortcircuit == matchct)
 			    return;
+		    }
 		    pathbuf[pathpos = oppos] = '\0';
 		}
 	    }
@@ -618,11 +620,12 @@ scanner(Complist q, int shortcircuit)
 		    memcpy(subdirs + subdirlen, (char *)&errsfound,
 			   sizeof(int));
 		    subdirlen += sizeof(int);
-		} else
+		} else {
 		    /* if the last filename component, just add it */
 		    insert(fn, 1);
 		    if (shortcircuit && shortcircuit == matchct)
 			return;
+		}
 	    }
 	}
 	closedir(lock);