[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20241110130846.GK4507@kernel.org>
Date: Sun, 10 Nov 2024 13:08:46 +0000
From: Simon Horman <horms@...nel.org>
To: Johannes Berg <johannes@...solutions.net>
Cc: linux-wireless@...r.kernel.org, netdev@...r.kernel.org,
Johannes Berg <johannes.berg@...el.com>
Subject: Re: [PATCH v2 2/2] net: convert to nla_get_*_default()
On Thu, Nov 07, 2024 at 01:43:31PM +0100, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@...el.com>
>
> Most of the original conversion is from the spatch below,
> but I edited some and left out other instances that were
> either buggy after conversion (where default values don't
> fit into the type) or just looked strange.
>
> @@
> expression attr, def;
> expression val;
> identifier fn =~ "^nla_get_.*";
> fresh identifier dfn = fn ## "_default";
> @@
> (
> -if (attr)
> - val = fn(attr);
> -else
> - val = def;
> +val = dfn(attr, def);
> |
> -if (!attr)
> - val = def;
> -else
> - val = fn(attr);
> +val = dfn(attr, def);
> |
> -if (!attr)
> - return def;
> -return fn(attr);
> +return dfn(attr, def);
> |
> -attr ? fn(attr) : def
> +dfn(attr, def)
> |
> -!attr ? def : fn(attr)
> +dfn(attr, def)
> )
>
> Signed-off-by: Johannes Berg <johannes.berg@...el.com>
Reviewed-by: Simon Horman <horms@...nel.org>
Powered by blists - more mailing lists