diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2020-06-12 14:11:33 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2020-06-12 14:11:33 -0400 |
commit | cae28a955824115ed0a1f3c925469286569fd1bc (patch) | |
tree | 3ba9061f3cd542c168ca92e0b6c3fc8b634bdd2d | |
parent | 30969de9bfe7d565e70eef6c23095741ffb9b285 (diff) | |
download | bfs-cae28a955824115ed0a1f3c925469286569fd1bc.tar.xz |
bftw: Only do another level of deepening if there are unexplored directories
This makes -S ids about 20% faster on a checkout of the Linux kernel.
-rw-r--r-- | bftw.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -1528,13 +1528,14 @@ static enum bftw_action bftw_ids_callback(const struct BFTW *ftwbuf, void *ptr) } } - state->bottom = false; - enum bftw_action ret = state->delegate(ftwbuf, state->ptr); switch (ret) { case BFTW_CONTINUE: - ret = BFTW_PRUNE; + if (ftwbuf->typeflag == BFTW_DIR) { + state->bottom = false; + ret = BFTW_PRUNE; + } break; case BFTW_PRUNE: if (ftwbuf->typeflag == BFTW_DIR) { |