aboutsummaryrefslogtreecommitdiff
path: root/lib/io/src/unix
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-05-14 03:37:36 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-05-14 03:38:00 +0200
commit7d01bbb78c11cb54c96cf9708916a116190364cb (patch)
tree93ed0294338d3fca7826b1ec9280c56a7ffda66b /lib/io/src/unix
parent5e96ce975e021551006ebff744c104f20d49741b (diff)
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 <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/io/src/unix')
-rw-r--r--lib/io/src/unix/dir_iterator.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/io/src/unix/dir_iterator.c b/lib/io/src/unix/dir_iterator.c
index d67fe83..d2727ad 100644
--- a/lib/io/src/unix/dir_iterator.c
+++ b/lib/io/src/unix/dir_iterator.c
@@ -121,6 +121,11 @@ static int dir_next(dir_iterator_t *base, dir_entry_t **out)
return it->state;
}
+static void dir_ignore_subdir(dir_iterator_t *it)
+{
+ (void)it;
+}
+
static int dir_open_subdir(dir_iterator_t *base, dir_iterator_t **out)
{
const unix_dir_iterator_t *it = (const unix_dir_iterator_t *)base;
@@ -160,6 +165,7 @@ static int dir_open_subdir(dir_iterator_t *base, dir_iterator_t **out)
((dir_iterator_t *)sub)->next = dir_next;
((dir_iterator_t *)sub)->read_link = dir_read_link;
((dir_iterator_t *)sub)->open_subdir = dir_open_subdir;
+ ((dir_iterator_t *)sub)->ignore_subdir = dir_ignore_subdir;
*out = (dir_iterator_t *)sub;
return 0;
@@ -199,6 +205,7 @@ dir_iterator_t *dir_iterator_create(const char *path)
((dir_iterator_t *)it)->next = dir_next;
((dir_iterator_t *)it)->read_link = dir_read_link;
((dir_iterator_t *)it)->open_subdir = dir_open_subdir;
+ ((dir_iterator_t *)it)->ignore_subdir = dir_ignore_subdir;
return (dir_iterator_t *)it;
}