Surround list macros in parens in order to allow calls like this:
list_t list; foreach(node, &list) { ... }
This commit is contained in:
parent
9cf86430ee
commit
fd8c5db72a
@ -46,7 +46,7 @@ node_t * list_insert_after(list_t * list, node_t * before, void * item);
|
||||
void list_append_before(list_t * list, node_t * after, node_t * node);
|
||||
node_t * list_insert_before(list_t * list, node_t * after, void * item);
|
||||
|
||||
#define foreach(i, list) for (node_t * i = list->head; i != NULL; i = i->next)
|
||||
#define foreachr(i, list) for (node_t * i = list->tail; i != NULL; i = i->prev)
|
||||
#define foreach(i, list) for (node_t * i = (list)->head; i != NULL; i = i->next)
|
||||
#define foreachr(i, list) for (node_t * i = (list)->tail; i != NULL; i = i->prev)
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user