summaryrefslogtreecommitdiffstats
path: root/src/eval.c
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/eval.c
parentf48f8346ff96dc2183716104d5181b894451acc8 (diff)
downloadbfs-25b4e40cd32175f39b94ffaa034bd46b428d8545.tar.xz
expr: New for_expr macro
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/eval.c b/src/eval.c
index 3d75f80..2ca4a1f 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -402,7 +402,7 @@ static int eval_exec_finish(const struct bfs_expr *expr, const struct bfs_ctx *c
}
}
- for (struct bfs_expr *child = bfs_expr_children(expr); child; child = child->next) {
+ for_expr (child, expr) {
if (eval_exec_finish(child, ctx) != 0) {
ret = -1;
}
@@ -1089,7 +1089,7 @@ bool eval_not(const struct bfs_expr *expr, struct bfs_eval *state) {
* Evaluate a conjunction.
*/
bool eval_and(const struct bfs_expr *expr, struct bfs_eval *state) {
- for (struct bfs_expr *child = bfs_expr_children(expr); child; child = child->next) {
+ for_expr (child, expr) {
if (!eval_expr(child, state) || state->quit) {
return false;
}
@@ -1102,7 +1102,7 @@ bool eval_and(const struct bfs_expr *expr, struct bfs_eval *state) {
* Evaluate a disjunction.
*/
bool eval_or(const struct bfs_expr *expr, struct bfs_eval *state) {
- for (struct bfs_expr *child = bfs_expr_children(expr); child; child = child->next) {
+ for_expr (child, expr) {
if (eval_expr(child, state) || state->quit) {
return true;
}
@@ -1117,7 +1117,7 @@ bool eval_or(const struct bfs_expr *expr, struct bfs_eval *state) {
bool eval_comma(const struct bfs_expr *expr, struct bfs_eval *state) {
bool ret uninit(false);
- for (struct bfs_expr *child = bfs_expr_children(expr); child; child = child->next) {
+ for_expr (child, expr) {
ret = eval_expr(child, state);
if (state->quit) {
break;
@@ -1594,7 +1594,7 @@ static bool eval_must_buffer(const struct bfs_expr *expr) {
return true;
}
- for (struct bfs_expr *child = bfs_expr_children(expr); child; child = child->next) {
+ for_expr (child, expr) {
if (eval_must_buffer(child)) {
return true;
}