From 7d01bbb78c11cb54c96cf9708916a116190364cb Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sun, 14 May 2023 03:37:36 +0200 Subject: libio: Move skip function into dir_iterator_t base interface For regular iterator types, it's a no-op, for the tree iterator, it skips the sub tree. Signed-off-by: David Oberhollenzer --- include/io/dir_iterator.h | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'include/io/dir_iterator.h') diff --git a/include/io/dir_iterator.h b/include/io/dir_iterator.h index 74027f5..60c3796 100644 --- a/include/io/dir_iterator.h +++ b/include/io/dir_iterator.h @@ -125,6 +125,17 @@ typedef struct dir_iterator_t { */ int (*open_subdir)(struct dir_iterator_t *it, struct dir_iterator_t **out); + + /** + * @brief Skip a sub-hierarchy on a stacked iterator + * + * If an iterator would ordinarily recurse into a sub-directory, + * tell it to skip those entries. On simple, flag iterators like the + * one returned by @ref dir_iterator_create, this has no effect. + * + * @param it A pointer to the iterator itself. + */ + void (*ignore_subdir)(struct dir_iterator_t *it); } dir_iterator_t; enum { @@ -215,16 +226,6 @@ SQFS_INTERNAL dir_iterator_t *dir_tree_iterator_create(const char *path, const dir_tree_cfg_t *cfg); -/** - * @brief Skip a sub-hierarchy on a stacked iterator - * - * For an iterator returned by @ref dir_tree_iterator_create, if the last entry - * was a directory, do not recurse, but instead skip across the netire sub-tree. - * - * @param it A pointer to an iterator returned by @ref dir_tree_iterator_create - */ -SQFS_INTERNAL void dir_tree_iterator_skip(dir_iterator_t *it); - #ifdef __cplusplus } #endif -- cgit v1.2.3