Re: pull: minor tidbits

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

 



On Tuesday 2009-05-26 14:08, Pablo Neira Ayuso wrote:
>
>@@ -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.

If you never take the address of limit, the static keyword is just
added safety sugar for when you do. Compiler does not recalculate
anything even without it, it's merely a hint to put it into the
right section, instead of the stack.
--
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