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

From: <samee.zahur_AT_gmail.com>
Date: Wed, 1 Jan 2020 12:18:49 -0800

From: Samee Zahur <samee.zahur_AT_gmail.com>

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.

Tested on gcc --version:
gcc (Ubuntu 9.2.1-9ubuntu2) 9.2.1 20191008
---
 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 - 21:18:49 CET

This archive was generated by hypermail 2.3.0 : Wed Jan 01 2020 - 21:24:23 CET