clang-format: bring back ForeachMacros (#3948)
* clang-format: bring back ForeachMacros
ForeachMacros was disabled in 4211274fcd
due to the breakage of include/queue.h. The currently used version,
clang-format-6.0 doesn't break it.
* Add curly braces
Co-authored-by: Orestis Floros <orestisflo@gmail.com>
This commit is contained in:
@ -28,15 +28,15 @@
|
||||
|
||||
#define NODES_FOREACH(head) \
|
||||
for (Con *child = (Con *)-1; (child == (Con *)-1) && ((child = 0), true);) \
|
||||
TAILQ_FOREACH(child, &((head)->nodes_head), nodes)
|
||||
TAILQ_FOREACH (child, &((head)->nodes_head), nodes)
|
||||
|
||||
#define NODES_FOREACH_REVERSE(head) \
|
||||
for (Con *child = (Con *)-1; (child == (Con *)-1) && ((child = 0), true);) \
|
||||
TAILQ_FOREACH_REVERSE(child, &((head)->nodes_head), nodes_head, nodes)
|
||||
TAILQ_FOREACH_REVERSE (child, &((head)->nodes_head), nodes_head, nodes)
|
||||
|
||||
/* greps the ->nodes of the given head and returns the first node that matches the given condition */
|
||||
#define GREP_FIRST(dest, head, condition) \
|
||||
NODES_FOREACH(head) { \
|
||||
NODES_FOREACH (head) { \
|
||||
if (!(condition)) \
|
||||
continue; \
|
||||
\
|
||||
|
Reference in New Issue
Block a user