[PATCH] ctdb: simplify logic (Re: [PATCH] Fixes related to ctdb command line option --nosetsched)

Michael Adam obnox at samba.org
Mon Jun 20 14:29:38 UTC 2016


On 2016-06-21 at 00:13 +1000, Amitay Isaacs wrote:
> On Mon, Jun 20, 2016 at 7:39 PM, Michael Adam <obnox at samba.org> wrote:
> 
> > Hi,
> >
> > attached find a follow-up patch to this patchset that
> > simplifies a bool assignment. Imho it reads more
> > naturally like this.
> >
> > Review appreciated!
> >
> > Michael
> >
> 
> I prefer the long form when multiple conditions are involved.  It makes
> easier for me to parse and make less mistakes.  I don't think expressions
> with double negatives read naturally.

Hmm, it depends. Sometimes !(a || b) reads more natuarally
and sometimes (!a && !b) does. But this was not my point:
I found it rather unnatural to read as is, but rather due to the
if (..) { x = true; } else { x = false; } pattern and
looking to turn that into one assignment.

> But if you really free strongly
> about the patch, someone else can review and push it.

No need, but how about this:

	ctdb->do_setsched = (options.nosetsched != 1);
	if (ctdb->valgrinding) {
		ctdb->do_setsched = false;
	}

That makes it clear what is the rule
and what is the exception.

If you also dislike this, I'll drop the request. :-)

Cheers - Michael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20160620/0ccac229/signature.sig>


More information about the samba-technical mailing list