Re: [hackers] [dwm] [PATCH] get rid of unnecessary ternary operator

From: Anselm R Garbe <garbeam_AT_gmail.com>
Date: Thu, 27 Oct 2016 10:02:32 +0200

To me ! is logical NOT and your suggestion relies on the fact that
XUrgencyHint is a single bit flag? no?

I prefer the original code, as it doesn't use side effects of logical NOTs.

-Anselm

On 27 October 2016 at 01:40, Markus Teich <markus.teich_AT_stusta.mhn.de> wrote:
> ---
> dwm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/dwm.c b/dwm.c
> index 3d6cc28..85ec75e 100644
> --- a/dwm.c
> +++ b/dwm.c
> _AT_@ -2020,7 +2020,7 @@ updatewmhints(Client *c)
> wmh->flags &= ~XUrgencyHint;
> XSetWMHints(dpy, c->win, wmh);
> } else
> - c->isurgent = (wmh->flags & XUrgencyHint) ? 1 : 0;
> + c->isurgent = !!(wmh->flags & XUrgencyHint);
> if (wmh->flags & InputHint)
> c->neverfocus = !wmh->input;
> else
> --
> 2.7.3
>
>
Received on Thu Oct 27 2016 - 10:02:32 CEST

This archive was generated by hypermail 2.3.0 : Thu Oct 27 2016 - 10:12:15 CEST