Search Linux Wireless

Re: [PATCH v2 2/2] net: convert to nla_get_*_default()

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

 



On Thu, Nov 07, 2024 at 01:43:31PM +0100, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@xxxxxxxxx>
> 
> 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@xxxxxxxxx>

Reviewed-by: Simon Horman <horms@xxxxxxxxxx>





[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux