Re: [PATCH v4 09/45] sequencer: remove useless indentation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jun 09, 2013 at 02:16:29PM -0500, Felipe Contreras wrote:
> On Sun, Jun 9, 2013 at 2:08 PM, Fredrik Gustafsson <iveqy@xxxxxxxxx> 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 Contreras

Oh, 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@xxxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]