mirror of
https://github.com/awesomeWM/awesome
synced 2024-11-17 07:47:41 +01:00
array: add foreach() statement
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
82dd52ad69
commit
e145afec53
1 changed files with 5 additions and 0 deletions
|
@ -30,6 +30,11 @@
|
|||
int len, size; \
|
||||
} pfx##_array_t;
|
||||
|
||||
#define foreach(var, array) \
|
||||
for(typeof((array).tab) var = (array).tab; \
|
||||
var < (array).tab + (array).len; \
|
||||
var++)
|
||||
|
||||
#define ARRAY_FUNCS(type_t, pfx, dtor) \
|
||||
static inline pfx##_array_t * pfx##_array_new(void) { \
|
||||
return p_new(pfx##_array_t, 1); \
|
||||
|
|
Loading…
Reference in a new issue