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

2020-01-02 Thread Samee Zahur
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
@@ -634,7 +634,7 @@ setup(void)
  /* no focused window is on screen, so use pointer location instead */
  if (mon < 0 && !area && XQueryPointer(dpy, root, , , , ,
, , ))
  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



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

2020-01-01 Thread samee . zahur
From: Samee Zahur 

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
@@ -634,7 +634,7 @@ setup(void)
/* no focused window is on screen, so use pointer location 
instead */
if (mon < 0 && !area && XQueryPointer(dpy, root, , , , 
, , , ))
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