[PATCH libinput 2/9] Fix up ARRAY_FOR_EACH macro

Peter Hutterer peter.hutterer at who-t.net
Thu Mar 27 21:38:45 PDT 2014


Remove compiler warning about signed/unsigned comparison. And while we're at
it, rename i to _i in the macro to avoid name clashes.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/libinput-util.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libinput-util.h b/src/libinput-util.h
index 2fbce72..c920568 100644
--- a/src/libinput-util.h
+++ b/src/libinput-util.h
@@ -71,7 +71,7 @@ int list_empty(const struct list *list);
 
 #define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0])
 #define ARRAY_FOR_EACH(_arr, _elem) \
-	for (int i = 0; (_elem = &_arr[i]) && i < ARRAY_LENGTH(_arr); i++)
+	for (size_t _i = 0; (_elem = &_arr[_i]) && _i < ARRAY_LENGTH(_arr); _i++)
 
 #define min(a, b) (((a) < (b)) ? (a) : (b))
 #define max(a, b) (((a) > (b)) ? (a) : (b))
-- 
1.8.5.3



More information about the wayland-devel mailing list