[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1450203727.4142.13.camel@perches.com>
Date: Tue, 15 Dec 2015 10:22:07 -0800
From: Joe Perches <joe@...ches.com>
To: SF Markus Elfring <elfring@...rs.sourceforge.net>,
Dan Carpenter <dan.carpenter@...cle.com>
Cc: Andreas Dilger <andreas.dilger@...el.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Oleg Drokin <oleg.drokin@...el.com>,
lustre-devel@...ts.lustre.org, devel@...verdev.osuosl.org,
LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org,
Julia Lawall <julia.lawall@...6.fr>
Subject: Re: staging: lustre: Delete unnecessary goto statements in six
functions
On Tue, 2015-12-15 at 19:02 +0100, SF Markus Elfring wrote:
> > This is the original code:
> Really …?
> > result = baz();
> > if (result)
> > goto label;
> >
> > label:
> > go on...
>
> I do not see such a source code structure
> at the six places I propose to clean-up.
>
>
> > I don't find the test->goto label; label: use offensive,
> > but if he does, I think keeping a blank line in place of
> > the test->goto might be better.
>
> I find this an interesting view on source code layout.
> Are there any more opinions around such implementation details?
Or to put it another way, use a blank line before the
first or only label in an error/out block.
I don't find it different then commonly written blocks like:
void foo(void)
{
...;
wind1();
val = func1(...);
if (val) {
printk(...);
goto err_type;
}
wind2();
val = func2(...);
if (val) {
printk(...);
goto err_type2;
}
...
return 0;
err_type2:
unwind2();
err_type:
unwind1();
return -ERR;
}
Yes, you can elide all the blank lines, but using them can
help readability.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists