From 71d8077dca5e5c407dff934d549fcfea53f83ede Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sun, 23 Jun 2019 10:15:52 -0400 Subject: bftw: Remove BFTW_SKIP_SIBLINGS It's not used by bfs, and it's difficult to support in all search strategies. --- eval.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'eval.c') diff --git a/eval.c b/eval.c index d2eea03..d89e62a 100644 --- a/eval.c +++ b/eval.c @@ -771,7 +771,7 @@ error: * -prune action. */ bool eval_prune(const struct expr *expr, struct eval_state *state) { - state->action = BFTW_SKIP_SUBTREE; + state->action = BFTW_PRUNE; return true; } @@ -1042,7 +1042,7 @@ static bool eval_file_unique(struct eval_state *state, struct trie *seen) { } if (leaf->value) { - state->action = BFTW_SKIP_SUBTREE; + state->action = BFTW_PRUNE; return false; } else { leaf->value = leaf; @@ -1151,8 +1151,7 @@ static const char *dump_bftw_visit(enum bftw_visit visit) { static const char *dump_bftw_action(enum bftw_action action) { static const char *actions[] = { DUMP_BFTW_MAP(BFTW_CONTINUE), - DUMP_BFTW_MAP(BFTW_SKIP_SIBLINGS), - DUMP_BFTW_MAP(BFTW_SKIP_SUBTREE), + DUMP_BFTW_MAP(BFTW_PRUNE), DUMP_BFTW_MAP(BFTW_STOP), }; return actions[action]; @@ -1190,7 +1189,7 @@ static enum bftw_action cmdline_callback(const struct BFTW *ftwbuf, void *ptr) { args->ret = EXIT_FAILURE; eval_error(&state, "%s.\n", strerror(ftwbuf->error)); } - state.action = BFTW_SKIP_SUBTREE; + state.action = BFTW_PRUNE; goto done; } @@ -1203,12 +1202,12 @@ static enum bftw_action cmdline_callback(const struct BFTW *ftwbuf, void *ptr) { if (cmdline->xargs_safe && strpbrk(ftwbuf->path, " \t\n\'\"\\")) { args->ret = EXIT_FAILURE; eval_error(&state, "Path is not safe for xargs.\n"); - state.action = BFTW_SKIP_SUBTREE; + state.action = BFTW_PRUNE; goto done; } if (cmdline->maxdepth < 0 || ftwbuf->depth >= cmdline->maxdepth) { - state.action = BFTW_SKIP_SUBTREE; + state.action = BFTW_PRUNE; } // In -depth mode, only handle directories on the BFTW_POST visit -- cgit v1.2.3