diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2018-06-25 13:51:32 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2018-06-25 13:51:32 -0400 |
commit | fcd95bfc4801037d747328911d2201a81cca5534 (patch) | |
tree | 214a3fffe9fe4795bd053fe04fd89299fbbf71aa /bftw.c | |
parent | aa2401a60ac5243bed8616b108894d7a954bba8e (diff) | |
download | bfs-fcd95bfc4801037d747328911d2201a81cca5534.tar.xz |
bftw: Use bftw_action as the return type when applicable
Diffstat (limited to 'bftw.c')
-rw-r--r-- | bftw.c | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -856,7 +856,7 @@ static void bftw_prepare_visit(struct bftw_state *state) { /** * Invoke the callback. */ -static int bftw_visit_path(struct bftw_state *state) { +static enum bftw_action bftw_visit_path(struct bftw_state *state) { if (state->reader.dir) { if (bftw_update_path(state) != 0) { state->error = errno; @@ -923,8 +923,8 @@ static struct bftw_reader *bftw_pop(struct bftw_state *state) { /** * Finalize and free a directory we're done with. */ -static int bftw_release_dir(struct bftw_state *state, struct bftw_dir *dir, bool do_visit) { - int ret = BFTW_CONTINUE; +static enum bftw_action bftw_release_dir(struct bftw_state *state, struct bftw_dir *dir, bool do_visit) { + enum bftw_action ret = BFTW_CONTINUE; if (!(state->flags & BFTW_DEPTH)) { do_visit = false; @@ -958,8 +958,8 @@ static int bftw_release_dir(struct bftw_state *state, struct bftw_dir *dir, bool /** * Close and release the reader. */ -static int bftw_release_reader(struct bftw_state *state, bool do_visit) { - int ret = BFTW_CONTINUE; +static enum bftw_action bftw_release_reader(struct bftw_state *state, bool do_visit) { + enum bftw_action ret = BFTW_CONTINUE; struct bftw_reader *reader = &state->reader; if (reader->handle) { @@ -1027,6 +1027,8 @@ int bftw(const char *path, bftw_fn *fn, int nopenfd, enum bftw_flags flags, void case BFTW_SKIP_SUBTREE: case BFTW_STOP: goto done; + default: + break; } if (state.ftwbuf.typeflag != BFTW_DIR) { @@ -1081,7 +1083,7 @@ int bftw(const char *path, bftw_fn *fn, int nopenfd, enum bftw_flags flags, void next: if (bftw_release_reader(&state, true) == BFTW_STOP) { - goto done; + break; } } |