Re: pull: minor tidbits

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

 



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
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux