Re: [PATCH net-next v3 07/13] tools: ynl-gen: avoid repetitive variables definitions

Donald Hunter <[email protected]> Fri, 12 Sep 2025 12:30:32 +0100
Newsgroups com.zx2c4.lists.wireguard,org.kernel.vger.linux-kernel,org.kernel.vger.netdev
Message-ID <[email protected]>
Asbjørn Sloth Tønnesen <[email protected]> writes:

> In the generated attribute parsing code, avoid repetitively
> defining the same variables over and over again, local to
> the conditional block for each attribute.
>
> This patch consolidates the definitions of local variables
> for attribute parsing, so that they are defined at the
> function level, and re-used across attributes, thus making
> the generated code read more natural.
>
> If attributes defines identical local_vars, then they will
> be deduplicated, attributes are assumed to only use their
> local variables transiently.
>
> ...
>
> Suggested-by: Jakub Kicinski <[email protected]>
> Signed-off-by: Asbjørn Sloth Tønnesen <[email protected]>

Reviewed-by: Donald Hunter <[email protected]>