shared: add nm_c_list_for_each_entry_prev() helper macro

It's non-trivial to get this right. Add the macro for iterating the list
in reverse.
This commit is contained in:
Thomas Haller 2019-10-17 10:05:50 +02:00
parent c02710bb0f
commit 308beb85fe

View file

@ -17,6 +17,12 @@
_what && c_list_contains (list, &_what->member); \
})
/* iterate over the list backwards. */
#define nm_c_list_for_each_entry_prev(_iter, _list, _m) \
for (_iter = c_list_entry ((_list)->prev, __typeof__ (*_iter), _m); \
&(_iter)->_m != (_list); \
_iter = c_list_entry ((_iter)->_m.prev, __typeof__ (*_iter), _m))
/*****************************************************************************/
typedef struct {