Re: [PATCH 1/1] libbpf: Delete an unneeded bool conversion

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

 



On Mon, May 10, 2021 at 10:09 PM Leon Romanovsky <leon@xxxxxxxxxx> wrote:
>
> On Mon, May 10, 2021 at 11:00:29AM -0700, Andrii Nakryiko wrote:
> > On Mon, May 10, 2021 at 5:43 AM Zhen Lei <thunder.leizhen@xxxxxxxxxx> wrote:
> > >
> > > The result of an expression consisting of a single relational operator is
> > > already of the bool type and does not need to be evaluated explicitly.
> > >
> > > No functional change.
> > >
> > > Signed-off-by: Zhen Lei <thunder.leizhen@xxxxxxxxxx>
> > > ---
> >
> > See [0] and [1].
> >
> >   [0] https://lore.kernel.org/bpf/CAEf4BzYgLf5g3oztbA-CJR4gQ7AVKQAGrsHWCOgTtUMUM-Mxfg@xxxxxxxxxxxxxx/
> >   [1] https://lore.kernel.org/bpf/CAEf4BzZQ6=-h3g1duXFwDLr92z7nE6ajv8Rz_Zv=qx=-F3sRVA@xxxxxxxxxxxxxx/
>
> How long do you plan to fight with such patches?

As long as necessary. There are better ways to contribute to libbpf
than doing cosmetic changes to the perfectly correct code.

>
> Thanks
>
> >
> > >  tools/lib/bpf/libbpf.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> > > index e2a3cf4378140f2..fa02213c451f4d2 100644
> > > --- a/tools/lib/bpf/libbpf.c
> > > +++ b/tools/lib/bpf/libbpf.c
> > > @@ -1504,7 +1504,7 @@ static int set_kcfg_value_tri(struct extern_desc *ext, void *ext_val,
> > >                                 ext->name, value);
> > >                         return -EINVAL;
> > >                 }
> > > -               *(bool *)ext_val = value == 'y' ? true : false;
> > > +               *(bool *)ext_val = value == 'y';
> > >                 break;
> > >         case KCFG_TRISTATE:
> > >                 if (value == 'y')
> > > --
> > > 2.26.0.106.g9fadedd
> > >
> > >



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux