[hackers] [dmenu] [PATCH] Fix GCC warning about using '*' in boolean context

From: Samee Zahur <samee.zahur_AT_gmail.com>
Date: Tue, 31 Dec 2019 16:28:06 -0800

Tested on gcc --version:
gcc (Ubuntu 9.2.1-9ubuntu2) 9.2.1 20191008

Was getting the following warning:

  dmenu.c: In function ‘setup’:
  dmenu.c:24:30: warning: ‘*’ in boolean context, suggest ‘&&’ instead
[-Wint-in-bool-context]
  [...]
  dmenu.c:637:9: note: in expansion of macro ‘INTERSECT’

Warning no longer emitted after fix.
---
 dmenu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dmenu.c b/dmenu.c
index 65f25ce..1e37a9a 100644
--- a/dmenu.c
+++ b/dmenu.c
_AT_@ -634,7 +634,7 @@ setup(void)
  /* no focused window is on screen, so use pointer location instead */
  if (mon < 0 && !area && XQueryPointer(dpy, root, &dw, &dw, &x, &y,
&di, &di, &du))
  for (i = 0; i < n; i++)
- if (INTERSECT(x, y, 1, 1, info[i]))
+ if (INTERSECT(x, y, 1, 1, info[i]) != 0)
  break;
  x = info[i].x_org;
-- 
2.20.1
Received on Wed Jan 01 2020 - 01:28:06 CET

This archive was generated by hypermail 2.3.0 : Thu Jan 02 2020 - 10:24:25 CET