From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Jan Engelhardt <jengelh@medozas.de>
Cc: kaber@trash.net, netfilter-devel@vger.kernel.org
Subject: Re: pull: minor tidbits
Date: Tue, 26 May 2009 14:08:07 +0200 [thread overview]
Message-ID: <4A1BDBA7.8080209@netfilter.org> (raw)
In-Reply-To: <4A1BD494.9090105@netfilter.org>
Pablo Neira Ayuso wrote:
> Hi Jan,
>
> Jan Engelhardt wrote:
>> Please pull from
>> git://dev.medozas.de/iptables master
>>
>> to receive non-API-touching minor cosmetics and a few fixes
>> to recently-reported issues:
>>
>> xtables: use extern "C"
>> extensions: add const qualifiers in print/save functions
>> iptables: replace open-coded sizeof by ARRAY_SIZE
>> addrtype: fix one manpage type
>> manpages: do not include v4-only modules in ip6tables manpage
>
> This all look sane to me :). I'm going to apply them unless Patrick does
> it faster than me ;).
>
> BTW, one minor cosmetic comment:
> + for (i = 0; i < ARRAY_SIZE(sctp_chunk_names); ++i)
> if (strcasecmp(sctp_chunk_names[i].name, ptr) == 0) {
> DEBUGP("Chunk num %d\n", sctp_chunk_names[i].chunk_type);
> SCTP_CHUNKMAP_SET(einfo->chunkmap,
> @@ -206,7 +194,6 @@ parse_sctp_chunk(struct xt_sctp_info *einfo,
> found = 1;
> break;
> }
> - }
>
> I like the brackets in the for() statement, it's good to disambiguate.
BTW:
@@ -75,7 +75,7 @@ static void mh_init(struct xt_entry_match *m)
static unsigned int name_to_type(const char *name)
{
int namelen = strlen(name);
- unsigned int limit = sizeof(mh_names)/sizeof(struct mh_name);
+ static const unsigned int limit = ARRAY_SIZE(mh_names);
unsigned int match = limit;
unsigned int i;
The use of static here looks to me like a clever trick to avoid
recalculations? I think this is a bit of abuse of static, the compiler
itself should notice this and avoid re-calculations.
--
"Los honestos son inadaptados sociales" -- Les Luthiers
next prev parent reply other threads:[~2009-05-26 12:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-26 11:26 pull: minor tidbits Jan Engelhardt
2009-05-26 11:26 ` [PATCH 1/5] xtables: use extern "C" Jan Engelhardt
2009-05-26 11:26 ` [PATCH 2/5] extensions: add const qualifiers in print/save functions Jan Engelhardt
2009-05-26 11:26 ` [PATCH 3/5] iptables: replace open-coded sizeof by ARRAY_SIZE Jan Engelhardt
2009-05-26 11:26 ` [PATCH 4/5] addrtype: fix one manpage type Jan Engelhardt
2009-05-26 11:26 ` [PATCH 5/5] manpages: do not include v4-only modules in ip6tables manpage Jan Engelhardt
2009-05-26 11:37 ` pull: minor tidbits Pablo Neira Ayuso
2009-05-26 12:08 ` Pablo Neira Ayuso [this message]
2009-05-26 13:08 ` Jan Engelhardt
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=4A1BDBA7.8080209@netfilter.org \
--to=pablo@netfilter.org \
--cc=jengelh@medozas.de \
--cc=kaber@trash.net \
--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).