Re: [PATCH v4 09/45] sequencer: remove useless indentation
- From
Fredrik Gustafsson <iveqy@iveqy.com>
- Date
- Jun 9, 2013, 19:48 UTC
- Message-ID
- <20130609194850.GD12122@paksenarrion.iveqy.com>
- In-Reply-To
- <CAMP44s0dNM2L7u=XPP82DnKFXmgC-kC6yeJYAgCPLeMEgJaH3A@mail.gmail.com>
On Sun, Jun 09, 2013 at 02:16:29PM -0500, Felipe Contreras wrote:
Show 41 quoted lines
> On Sun, Jun 9, 2013 at 2:08 PM, Fredrik Gustafsson <iveqy@iveqy.com> wrote:
> > On Sun, Jun 09, 2013 at 01:19:03PM -0500, Felipe Contreras wrote:
> >> The explains what the patch is doing, but not why. Why is more important.
> >
> > You're right. Why are the indentation useless? It doesn't seem to be
> > useless until you added goto. So why is your goto solution better than
> > the previous existing solution?
>
> Because it removes useless indentation :)
>
> This is what they do in the Linux kernel, you tell me which looks better:
>
> a)
>
> if (function1())
> goto leave;
> if (function2())
> goto leave;
> if (function3())
> goto leave;
> if (function4())
> goto leave;
> good_stuff();
> leave:
> final_stuff();
>
> or b)
>
> if (!function1()) {
> if (!function2()) {
> if (!function3()) {
> if (!function4()) {
> good_stuff();
> }
> }
> }
> }
> final_stuff();
>
> --
> Felipe ContrerasOh, so this is purely a "this code style is better than the current code style"-patch? I won't argue with that. I simply trust Junio in such cases, I had such discussions with him before.
I thought it was partly to increase cleanup capabilities to. For example, why isn't msg and defmsg freed when "return allow"?
Still wonder about introducing a new label name for cleanup.
-- Med vänliga hälsningar Fredrik Gustafsson tel: 0733-608274 e-post: iveqy@iveqy.com