Fix up ARRAY_FOR_EACH macro
authorPeter Hutterer <peter.hutterer@who-t.net>
Tue, 25 Mar 2014 01:19:52 +0000 (11:19 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Thu, 10 Apr 2014 01:11:56 +0000 (11:11 +1000)
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@who-t.net>
Reviewed-by: Jonas Ã…dahl <jadahl@gmail.com>
src/libinput-util.h

index 2fbce72f2902061cc301d237eb454761d9ba9159..c9205686c28d41cb32181a18b71768aff21c814d 100644 (file)
@@ -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))