Conditions always true in tevent_standard.c

Nikolai Kondrashov Nikolai.Kondrashov at
Mon Jul 4 16:17:20 UTC 2016

On 06/30/2016 10:24 PM, Jeremy Allison wrote:
> On Wed, Jun 29, 2016 at 03:43:34PM +0300, Nikolai Kondrashov wrote:
>> Please find the patch attached. I also tried to rearrange the conditions to
>> make the code easier to understand.
> I like the comment. I don't like the rearrangement of conditions.
> In Samba we prefer simplified if statement that cause early exit,
> rather than complex if conditions. Unfortunately your patch makes
> the if conditions complex.
> I'd prefer something that just adds the comment before the
> if == NULL check.

I understand, and this sounds like a good convention in general.
However, I think it makes these small functions and conditions harder to read.
Perhaps an exception for small functions would be in order.

Regardless, it's your code and you decide, so here is an updated patch :)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-tevent-Clarify-apparently-useless-conditions.patch
Type: text/x-patch
Size: 1961 bytes
Desc: not available
URL: <>

More information about the samba-technical mailing list