lkml.org 
[lkml]   [2008]   [Feb]   [23]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateSat, 23 Feb 2008 16:31:35 +0100 (CET)
FromJan Engelhardt <>
SubjectRe: Merging of completely unreviewed drivers
On Feb 21 2008 22:37, Ray Lee wrote:
>On Thu, Feb 21, 2008 at 7:13 PM, Linus Torvalds
><torvalds@linux-foundation.org> wrote:
>>  So I'd be happier with warnings about deep indentation (but how do you
>>  count it? Will people then try to fake things out by using 4-space indents
>>  and then "deep" indentations will look like just a couple of tabs?)
>
>I suspect that 90% of the cases that people really care about would
>get caught successfully just by counting brace depth.
>
>ie, by looking at { { {} {} {{{}{}}} } } I bet you can tell me which
>section should have been pulled out into a separate routine.

Not only that. By clever branch factoring, you can possibly get yourself
rid of lots of deep levels. As in:

static void blah(void)
{
	if (foo) {
		bar;
		bar2;
	} else {
		if (this) {
			that;
			that2;
		} else {
			bad day;
			bad day2;
		}
	}
}
xfrmd:

static void blah(void)
{
	if (foo) {
		bar;
		bar2;
		return;
	}
	if (this) {
		that;
		that2;
		return;
	}
	/* yay, got rid of two levels of indent! */
	good day;
	good day2;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2008-02-23 16:33    [from the cache]
©2003-2008