Diffusion Baloo 3319b6656043

Replace recursion in FilteredDirIterator with loop iteration

Authored by bruns on Oct 8 2019, 1:35 PM.

Description

Replace recursion in FilteredDirIterator with loop iteration

Summary:
In case many consecutive files are skipped in a directory, the
recursive next() implementation recursed for every file, i.e.
calling itself repeatedly.

Instead, loop over all directory items until either a file or directory
is found which should be indexed, or there are no more items left.

Move the "shouldIndexHidden" variable out of the loop, as it is
invariant.

Test Plan: ctest -R filtereddiriterator

Reviewers: Baloo, ngraham, astippich

Reviewed By: Baloo, ngraham

Subscribers: kde-frameworks-devel

Tags: Frameworks, Baloo

Differential Revision: https://phabricator.kde.org/D24502