+EINA_INLIST_FOREACH_SAFE

it looks crazy, but it works somehow


SVN revision: 57080
This commit is contained in:
Mike Blumenkrantz 2011-02-16 09:34:27 +00:00
parent 2c428c4c15
commit b48b7eb6ea
2 changed files with 7 additions and 0 deletions

View File

@ -10,3 +10,6 @@
* Added eina_unicode_strndup
2011-02-16 Mike Blumenkrantz
* EINA_INLIST_FOREACH_SAFE

View File

@ -98,6 +98,10 @@ EAPI Eina_Accessor *eina_inlist_accessor_new(const Eina_Inlist *in_list) EINA_MA
#define EINA_INLIST_FOREACH(list, l) \
for (l = NULL, l = (list ? _EINA_INLIST_CONTAINER(l, list) : NULL); l; \
l = (EINA_INLIST_GET(l)->next ? _EINA_INLIST_CONTAINER(l, EINA_INLIST_GET(l)->next) : NULL))
#define EINA_INLIST_FOREACH_SAFE(list, list2, l) \
for (l = (list ? _EINA_INLIST_CONTAINER(l, list) : NULL), list2 = l ? ((EINA_INLIST_GET(l) ? EINA_INLIST_GET(l)->next : NULL)) : NULL; \
l; \
l = _EINA_INLIST_CONTAINER(l, list2), list2 = list2 ? list2->next : NULL)
#define EINA_INLIST_REVERSE_FOREACH(list, l) \
for (l = NULL, l = (list ? _EINA_INLIST_CONTAINER(l, list->last) : NULL); \
l; l = (EINA_INLIST_GET(l)->prev ? _EINA_INLIST_CONTAINER(l, EINA_INLIST_GET(l)->prev) : NULL))