From: Holger Eitzenberger <holger@eitzenberger.org>
To: Jan Engelhardt <jengelh@inai.de>
Cc: netfilter-devel <netfilter-devel@vger.kernel.org>
Subject: Re: [PATCH RFC 1/3] NFQUEUE: introduce CPU fanout
Date: Tue, 19 Mar 2013 23:30:40 +0100 [thread overview]
Message-ID: <20130319223040.GG13505@imap.eitzenberger.org> (raw)
In-Reply-To: <alpine.LNX.2.01.1303192249170.688@nerf07.vanv.qr>
> >having read through the webpage - and using 'goto' for error handling
> >in own code quite often - I don't see why your code above should be
> >more readable.
>
> It was only coincidental that the webpage also mentioned goto.
> The general idea (and google keywords) was called something like
> "Else Considered Harmful", and the lesson consisted of early
> exclusion of simple cases from the flow of the remainder of the
> function. Perhaps to illustrate it better:
>
> list_for_each_entry(thing, &yourlist, anchor) {
> if (thing->property == MAGIC) {
> do_stuff;
> }
> }
>
> =>
>
> list_for_each_entry(thing, &yourlist, anchor) {
> if (thing->property != MAGIC)
> continue;
> do_stuff;
> }
>
> Code may become more readable as one gains one level of indent and
> have some more freedom in arranging the giblets inside the do_stuff parts.
Ack.
next prev parent reply other threads:[~2013-03-19 22:30 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-19 14:14 [PATCH RFC 0/3] NFQUEUE: introduce CPU fanout holger
2013-03-19 14:14 ` [PATCH RFC 1/3] " holger
2013-03-19 14:26 ` David Miller
2013-03-19 14:34 ` Jan Engelhardt
2013-03-19 14:37 ` David Miller
2013-03-19 21:38 ` Holger Eitzenberger
2013-03-19 21:34 ` Holger Eitzenberger
2013-03-19 21:57 ` Jan Engelhardt
2013-03-19 22:30 ` Holger Eitzenberger [this message]
2013-03-19 19:56 ` Florian Westphal
2013-03-19 20:17 ` Holger Eitzenberger
2013-03-19 14:14 ` [PATCH RFC 2/3] NFQUEUE: coalesce IPv4 and IPv6 hashing holger
2013-03-19 14:27 ` David Miller
2013-03-19 14:39 ` Holger Eitzenberger
2013-03-19 14:14 ` [PATCH RFC 3/3] NFQUEUE: add --queue-cpu-fanout parameter holger
2013-03-19 14:34 ` Eric Leblond
2013-03-19 16:07 ` Holger Eitzenberger
2013-03-23 19:52 ` Holger Eitzenberger
2013-03-23 21:53 ` Eric Leblond
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130319223040.GG13505@imap.eitzenberger.org \
--to=holger@eitzenberger.org \
--cc=jengelh@inai.de \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).