Re: [PATCH v4] diffcore-break: use a goto instead of a redundant if statement

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

 



Alex Henrie <alexhenrie24@xxxxxxxxx> writes:

> Well, I admit that code clarity is somewhat subjective. To me it's not
> obvious that "if (q->nr <= j)" means "if the loop exited normally",

I actually do not have too much problem with this side of the
equation.  I however do see problem with squashing the two diff_q
calls that _happens_ to be textually the same but is made from two
logically separate codepaths (cases B.1 and C, in the message you
are responding to but omitted from quote).  After all, you did not
even realize you introduced a new bug by doing so before CB pointed
it out, no?  A rewrite like that that easily allows a new bug to
slip in hardly qualifies as making code "more clear and readable".

> but a goto does make it obvious. (And it's definitely more clear to
> scan-build, which complains about a possible memory leak when an if
> statement is used but does not complain when the if statement is
> replaced with a goto.)
>
> As far as the diff_q calls, I think that having one call instead of
> two is slightly more readable, but I don't care very much about it.
> I'd be happy to drop that change from the next version of the patch.
>
> -Alex



[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]

  Powered by Linux