Re: [PATCH] libxtables: Dont initialize global xt_params

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

 



Hi Jamal,

On Thursday, 12. February 2009 15:16:02 jamal wrote:
> commit 7aad144ecaf7603b17af5372886fe491c3bc6a2f
> Author: Jamal Hadi Salim <hadi@xxxxxxxxxx>
> Date:   Wed Feb 11 16:19:30 2009 -0500
>
>     Dont initialize global xt_params
>     To quote Jan Engelhardt <jengelh@xxxxxxxxxx>
>     "
>     Do not initialize static members - this takes up extra space
>     and adds no benefit. (zeroed anyway even in .bss)
>     "
>
>     Signed-off-by: Jamal Hadi Salim <hadi@xxxxxxxxxx>
>
> diff --git a/xtables.c b/xtables.c
> index 8e28d5e..114a393 100644
> --- a/xtables.c
> +++ b/xtables.c
> @@ -48,7 +48,7 @@
>
>  void basic_exit_err(enum xtables_exittype status, const char *msg, ...)
> __attribute__((noreturn, format(printf,2,3)));
>
> -struct xtables_globals *xt_params = NULL;
> +struct xtables_globals *xt_params;

Thanks for your patch. Did you know about zeroing of .bss before?

I see two possible drawbacks using this style:

1. Other people which don't know this "trick" will think
the variable is not initialized -> Hard to read.

2. If that variable gets moved f.e. inside a function, it will become 
uninitialized. Also I'm not sure if the savings are even measurable...

Just my two cents
Thomas

--
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