]> Sergey Matveev's repositories - bfs.git/commit
bftw: Fix unbuffered depth-first searches
authorTavian Barnes <tavianator@tavianator.com>
Thu, 12 Oct 2023 15:24:49 +0000 (11:24 -0400)
committerTavian Barnes <tavianator@tavianator.com>
Thu, 12 Oct 2023 15:39:08 +0000 (11:39 -0400)
commita029d95b5736a74879f32089514a5a6b63d6efbc
treecd555ca624296b5a700d04dbe9115a7e8a8402b3
parented2a50d63b25a7b72a32be07a33331544f587296
bftw: Fix unbuffered depth-first searches

bftw() implements depth-first search by appending files to a batch, then
prepending the batch to the queue.  When we switched to separate file/
directory queues, this was only implemented for the file queue.
Unbuffered searches don't use the file queue, so they were all breadth-
first in practice.

This meant that iterative deepening (-S ids) was actually "iterative
deepening *breadth*-first search," a horrible strategy with no advantage
over regular breadth-first search.  Now it performs iterative deepening
*depth*-first search, which at least limits its memory consumption.

Fixes: c1b16b49988ecff17ae30978ea14798d95b80018
src/bftw.c