Re: [PATCH] diff: remove another ternary expression always evaluating to true

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

 



Hi Stefan,

On Thu, 8 Aug 2013, Stefan Beller wrote:

> The condition before the changed line dereferences 'one' to query the mode,
> so if the condition evaluates to true, the variable one must not be null.

To show this better, please use -U10 (or some other appropriate context
option) in the future.

> Therefore we do not need the ternary operator depending on one, giving
> either one->path or two->path. This always evaluates to one->path, so we
> can remove the ternary operator.
> 
> The condition and the usage of the ternary operator have been introduced
> by the same commit (752c0c24, 2009-10-19, Add the --submodule option to
> the diff option family). As that commit message refers to a GitTogether
> I'd assume that patch was crafted in a hurry, so maybe overlooking the
> need for a ternary operator there.

If this is my code, I do not need a GitTogether to excuse my sloppiness.
In this particular case, I imagine the appropriate fix is to test for
one->path instead of removing the conditional, though.

Ciao,
Johannes
--
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]