list: fix LIF_LIST_FOREACH_SAFE() iteration on empty lists
This commit is contained in:
parent
ec6077f26f
commit
fe1664d311
1 changed files with 1 additions and 1 deletions
|
@ -40,7 +40,7 @@ extern void lif_node_delete(struct lif_node *node, struct lif_list *list);
|
||||||
for ((iter) = (head); (iter) != NULL; (iter) = (iter)->next)
|
for ((iter) = (head); (iter) != NULL; (iter) = (iter)->next)
|
||||||
|
|
||||||
#define LIF_LIST_FOREACH_SAFE(iter, iter_next, head) \
|
#define LIF_LIST_FOREACH_SAFE(iter, iter_next, head) \
|
||||||
for ((iter) = (head), (iter_next) = (iter)->next; (iter) != NULL; (iter) = (iter_next), (iter_next) = (iter) != NULL ? (iter)->next : NULL)
|
for ((iter) = (head), (iter_next) = (iter) != NULL ? (iter)->next : NULL; (iter) != NULL; (iter) = (iter_next), (iter_next) = (iter) != NULL ? (iter)->next : NULL)
|
||||||
|
|
||||||
#define LIF_LIST_FOREACH_REVERSE(iter, tail) \
|
#define LIF_LIST_FOREACH_REVERSE(iter, tail) \
|
||||||
for ((iter) = (tail); (iter) != NULL; (iter) = (iter)->prev)
|
for ((iter) = (tail); (iter) != NULL; (iter) = (iter)->prev)
|
||||||
|
|
Loading…
Reference in a new issue