Re: [PATCH] maint: Fix incorrect parenthesis placement causing true/false assignment

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

 



On Tue, Sep 05, 2017 at 11:02:46AM +0200, Martin Kletzander wrote:
> On Tue, Sep 05, 2017 at 10:17:36AM +0200, Erik Skultety wrote:
> > There were a few places in our code where the following pattern in 'if'
> > condition occurred:
> >
> > if ((foo = bar() < 0))
> >    do something;
> >
> > This patch adjusts the conditions to the expected format:
> >
> > if ((foo = bar()) < 0)
> >    do something;
> >
>
> I'd forbid this short ugly notation.  Whoever is lazy to write:
>
>  ...
>  foo = bar();
>  if (foo < 0)
>  ...
>
> is free to object until I send this e-mail.
>
> > Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1488192
> >
> > Signed-off-by: Erik Skultety <eskultet@xxxxxxxxxx>
> > ---
> >
> > This can be especially "fun" if you try to assign multiple RNG devices to a
> > domain and then try to hot-unplug any of them but the first. Anyhow I used the
> > regex below to find these, I haven't spent much time tuning in, so in case
> > you can come up with a better one that yields more results like these I'm all
> > ears :).
> >
> > [[:alnum:]_]+ = [[:print:]]+[^)]) < 0))
> >
>
> I tried some other ones that would find '==' or '!=' or stuff split in
> multiple lines and did not find any.
>
> Reviewed-by: Martin Kletzander <mkletzan@xxxxxxxxxx>

Pushed, thanks.

Erik


--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux