Thread (4 messages) flat view 4 messages, 2 authors, 2016-06-15

Re: [PATCH 2/3] dir.c: Omit non-excluded directories with dir->show_ignored

From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2016-06-15 22:43:08


On Sun, 6 May 2007, Michael Spang wrote:
quoted hunk ↗ jump to hunk
@@ -461,7 +462,7 @@ static int read_directory_recursive(struct dir_struct *dir, const char *path, co
 			memcpy(fullname + baselen, de->d_name, len+1);
 			if (simplify_away(fullname, baselen + len, simplify))
 				continue;
-			if (excluded(dir, fullname) != dir->show_ignored) {
+			if ((exclude = excluded(dir, fullname)) != dir->show_ignored) {
Style issue: please write this as

			exclude = excluded(dir, fullname);
			if (exclude != dir->show_ignored) {

instead. 

Yes, both are valid C, and mean the same thing, but one is much more 
readable than the other.

Combining multiple things inside an if-statement is convenient if:

 - the things inside are _really_ trivial.

 - it's done as part of macro expansion etc (ie it's not visible as such, 
   and the code is readable in its pre-preprocessor format)

but it's not good form otherwise.

		Linus
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help