Fix foreach macro
Fixes support of break/continue statement Signed-off-by: Mariusz Ceier <mceier@gmail.com> Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
505245a5ff
commit
7010ffd164
|
@ -34,9 +34,11 @@
|
|||
#define foreach(var, array) \
|
||||
for(int __foreach_index_##var = 0; \
|
||||
__foreach_index_##var < (array).len; \
|
||||
__foreach_index_##var++) \
|
||||
__foreach_index_##var = (array).len) \
|
||||
for(typeof((array).tab) var = &(array).tab[__foreach_index_##var]; \
|
||||
var; var = NULL)
|
||||
(__foreach_index_##var < (array).len) && \
|
||||
(var = &(array).tab[__foreach_index_##var]); \
|
||||
++__foreach_index_##var)
|
||||
|
||||
#define ARRAY_FUNCS(type_t, pfx, dtor) \
|
||||
static inline pfx##_array_t * pfx##_array_new(void) { \
|
||||
|
|
Loading…
Reference in New Issue