summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/color.c2
-rw-r--r--src/diag.c2
-rw-r--r--src/eval.c4
-rw-r--r--src/expr.h2
-rw-r--r--src/opt.c6
-rw-r--r--src/parse.c12
6 files changed, 14 insertions, 14 deletions
diff --git a/src/color.c b/src/color.c
index 94fcac8..8d32c6c 100644
--- a/src/color.c
+++ b/src/color.c
@@ -888,7 +888,7 @@ static int print_expr(CFILE *cfile, const struct bfs_expr *expr, bool verbose) {
const struct bfs_expr *lhs = NULL;
const struct bfs_expr *rhs = NULL;
- if (bfs_expr_has_children(expr)) {
+ if (bfs_expr_is_parent(expr)) {
lhs = expr->lhs;
rhs = expr->rhs;
diff --git a/src/diag.c b/src/diag.c
index c5e139e..a0c11f2 100644
--- a/src/diag.c
+++ b/src/diag.c
@@ -125,7 +125,7 @@ static bool highlight_expr_recursive(const struct bfs_ctx *ctx, const struct bfs
}
}
- if (bfs_expr_has_children(expr)) {
+ if (bfs_expr_is_parent(expr)) {
ret |= highlight_expr_recursive(ctx, expr->lhs, args);
ret |= highlight_expr_recursive(ctx, expr->rhs, args);
}
diff --git a/src/eval.c b/src/eval.c
index 4c9d807..e3257ce 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -387,7 +387,7 @@ static int eval_exec_finish(const struct bfs_expr *expr, const struct bfs_ctx *c
}
ret = -1;
}
- } else if (bfs_expr_has_children(expr)) {
+ } else if (bfs_expr_is_parent(expr)) {
if (expr->lhs && eval_exec_finish(expr->lhs, ctx) != 0) {
ret = -1;
}
@@ -1557,7 +1557,7 @@ static bool eval_must_buffer(const struct bfs_expr *expr) {
return true;
}
- if (bfs_expr_has_children(expr)) {
+ if (bfs_expr_is_parent(expr)) {
if (expr->lhs && eval_must_buffer(expr->lhs)) {
return true;
}
diff --git a/src/expr.h b/src/expr.h
index e541d8e..a52007a 100644
--- a/src/expr.h
+++ b/src/expr.h
@@ -210,7 +210,7 @@ struct bfs_expr *bfs_expr_new(bfs_eval_fn *eval, size_t argc, char **argv);
/**
* @return Whether the expression has child expressions.
*/
-bool bfs_expr_has_children(const struct bfs_expr *expr);
+bool bfs_expr_is_parent(const struct bfs_expr *expr);
/**
* @return Whether expr is known to always quit.
diff --git a/src/opt.c b/src/opt.c
index 441c611..56d4102 100644
--- a/src/opt.c
+++ b/src/opt.c
@@ -847,7 +847,7 @@ static struct bfs_expr *optimize_expr_recursive(struct opt_state *state, struct
return ret;
}
- if (!bfs_expr_has_children(expr) && !expr->pure) {
+ if (!bfs_expr_is_parent(expr) && !expr->pure) {
facts_union(state->facts_when_impure, state->facts_when_impure, &state->facts);
}
@@ -901,7 +901,7 @@ static struct bfs_expr *optimize_expr_recursive(struct opt_state *state, struct
return NULL;
}
- if (bfs_expr_has_children(expr)) {
+ if (bfs_expr_is_parent(expr)) {
struct bfs_expr *lhs = expr->lhs;
struct bfs_expr *rhs = expr->rhs;
if (rhs) {
@@ -980,7 +980,7 @@ static bool reorder_expr(const struct opt_state *state, struct bfs_expr *expr, f
* Whether any subexpression was reordered.
*/
static bool reorder_expr_recursive(const struct opt_state *state, struct bfs_expr *expr) {
- if (!bfs_expr_has_children(expr)) {
+ if (!bfs_expr_is_parent(expr)) {
return false;
}
diff --git a/src/parse.c b/src/parse.c
index a858a4c..320e165 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -109,7 +109,7 @@ struct bfs_expr *bfs_expr_new(bfs_eval_fn *eval_fn, size_t argc, char **argv) {
}
// Prevent bfs_expr_free() from freeing uninitialized pointers on error paths
- if (bfs_expr_has_children(expr)) {
+ if (bfs_expr_is_parent(expr)) {
expr->lhs = NULL;
expr->rhs = NULL;
} else if (eval_fn == eval_exec) {
@@ -123,7 +123,7 @@ struct bfs_expr *bfs_expr_new(bfs_eval_fn *eval_fn, size_t argc, char **argv) {
return expr;
}
-bool bfs_expr_has_children(const struct bfs_expr *expr) {
+bool bfs_expr_is_parent(const struct bfs_expr *expr) {
return expr->eval_fn == eval_and
|| expr->eval_fn == eval_or
|| expr->eval_fn == eval_not
@@ -140,7 +140,7 @@ void bfs_expr_free(struct bfs_expr *expr) {
return;
}
- if (bfs_expr_has_children(expr)) {
+ if (bfs_expr_is_parent(expr)) {
bfs_expr_free(expr->rhs);
bfs_expr_free(expr->lhs);
} else if (expr->eval_fn == eval_exec) {
@@ -166,7 +166,7 @@ static struct bfs_expr *new_unary_expr(bfs_eval_fn *eval_fn, struct bfs_expr *rh
expr->lhs = NULL;
expr->rhs = rhs;
- assert(bfs_expr_has_children(expr));
+ assert(bfs_expr_is_parent(expr));
expr->persistent_fds = rhs->persistent_fds;
expr->ephemeral_fds = rhs->ephemeral_fds;
@@ -186,7 +186,7 @@ static struct bfs_expr *new_binary_expr(bfs_eval_fn *eval_fn, struct bfs_expr *l
expr->lhs = lhs;
expr->rhs = rhs;
- assert(bfs_expr_has_children(expr));
+ assert(bfs_expr_is_parent(expr));
expr->persistent_fds = lhs->persistent_fds + rhs->persistent_fds;
if (lhs->ephemeral_fds > rhs->ephemeral_fds) {
@@ -3722,7 +3722,7 @@ static void dump_expr_multiline(const struct bfs_ctx *ctx, enum debug_flags flag
cfprintf(ctx->cerr, " ");
}
- if (bfs_expr_has_children(expr)) {
+ if (bfs_expr_is_parent(expr)) {
cfprintf(ctx->cerr, "(${red}%s${rs}\n", expr->argv[0]);
if (expr->lhs) {
dump_expr_multiline(ctx, flag, expr->lhs, indent + 1, 0);