mirror of
https://github.com/swaywm/sway.git
synced 2026-04-28 06:46:26 -04:00
list_for
This commit is contained in:
parent
4d9b05e649
commit
7dcca7a4b4
2 changed files with 65 additions and 87 deletions
|
|
@ -14,4 +14,13 @@ void list_insert(list_t *list, int index, void *item);
|
|||
void list_del(list_t *list, int index);
|
||||
void list_cat(list_t *list, list_t *source);
|
||||
|
||||
|
||||
// ITEM must be a pointer, LIST is list_t*
|
||||
// ITEM will be NULL after empty list
|
||||
#define list_for(ITEM, LIST) \
|
||||
ITEM = LIST->length ? LIST->items[0] : NULL; \
|
||||
for(int list_it = 0, list_len = LIST->length; \
|
||||
list_it < list_len; \
|
||||
ITEM = LIST->items[++list_it])
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue