[PATCH libinput 9/9] touchpad: Always assign iterator in tp_for_each_touch macro

Jonas Ådahl jadahl at gmail.com
Wed Apr 9 12:02:16 PDT 2014


Rewrite the tp_for_each_touch macro to always assign the iterator.
Practically it was already always assigning as ntouches is always more
than 0, but this way we avoid a compiler warning by not relying on an
external variable for initiating the iterator.

Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
---
 src/evdev-mt-touchpad.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h
index 2bdb329..3377789 100644
--- a/src/evdev-mt-touchpad.h
+++ b/src/evdev-mt-touchpad.h
@@ -141,7 +141,7 @@ struct tp_dispatch {
 };
 
 #define tp_for_each_touch(_tp, _t) \
-	for (unsigned int _i = 0; _i < (_tp)->ntouches && (_t = &(_tp)->touches[_i]); _i++)
+	for (_t = (_tp)->touches; _t < (_tp)->touches + (_tp)->ntouches; _t++)
 
 void
 tp_get_delta(struct tp_touch *t, double *dx, double *dy);
-- 
1.8.3.2



More information about the wayland-devel mailing list