summaryrefslogtreecommitdiffstats
path: root/src/expr.h
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2024-05-23 11:11:35 -0400
committerTavian Barnes <tavianator@tavianator.com>2024-05-23 11:11:35 -0400
commit25b4e40cd32175f39b94ffaa034bd46b428d8545 (patch)
tree8d580896f0c3bed403d379ef56ceaf361adf6c57 /src/expr.h
parentf48f8346ff96dc2183716104d5181b894451acc8 (diff)
downloadbfs-25b4e40cd32175f39b94ffaa034bd46b428d8545.tar.xz
expr: New for_expr macro
Diffstat (limited to 'src/expr.h')
-rw-r--r--src/expr.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/expr.h b/src/expr.h
index 7bcace7..60b298d 100644
--- a/src/expr.h
+++ b/src/expr.h
@@ -244,4 +244,10 @@ bool bfs_expr_cmp(const struct bfs_expr *expr, long long n);
*/
void bfs_expr_clear(struct bfs_expr *expr);
+/**
+ * Iterate over the children of an expression.
+ */
+#define for_expr(child, expr) \
+ for (struct bfs_expr *child = bfs_expr_children(expr); child; child = child->next)
+
#endif // BFS_EXPR_H