projects
/
platform
/
upstream
/
libinput.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
95c6ac6
)
util: add ARRAY_FOR_EACH helper
author
Peter Hutterer
<peter.hutterer@who-t.net>
Fri, 6 Dec 2013 04:35:22 +0000
(14:35 +1000)
committer
Jonas Ådahl
<jadahl@gmail.com>
Sat, 21 Dec 2013 11:09:55 +0000
(12:09 +0100)
Requires c99, but that's the future.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
src/libinput-util.h
patch
|
blob
|
history
diff --git
a/src/libinput-util.h
b/src/libinput-util.h
index
45549e0
..
381a0d4
100644
(file)
--- a/
src/libinput-util.h
+++ b/
src/libinput-util.h
@@
-70,6
+70,8
@@
int list_empty(const struct list *list);
tmp = container_of(pos->member.next, tmp, member))
#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++)
/*
* This fixed point implementation is a verbatim copy from wayland-util.h from