Re: [PATCH ulogd2 v2 v2 07/34] src: remove zero-valued config-key fields

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

 



On Tuesday 2022-11-29 22:47, Jeremy Sowden wrote:

>Struct members are zero-initialized as a matter of course.
>
>@@ -35,13 +35,10 @@ static struct config_keyset libulog_kset = {
> 		[MARK_MARK] = {
> 			.key 	 = "mark",
> 			.type 	 = CONFIG_TYPE_INT,
>-			.options = CONFIG_OPT_NONE,
>-			.u.value = 0,
> 		},

The struct is *aggregate-initialized*, which means two things:

 - unspecified elements are *empty-initialized*
 - since the cost of initialization has already been paid,
   one might as well be explicit about .options
   and not rely on CONFIG_OPT_NONE being 0.


NB: these structs could use a "const" qualifier.



[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux