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(a)redhat.com>
> ---
>
> 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(a)redhat.com>