summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/zix/filesystem.h19
-rw-r--r--src/posix/filesystem_posix.c8
-rw-r--r--src/win32/filesystem_win32.c8
3 files changed, 20 insertions, 15 deletions
diff --git a/include/zix/filesystem.h b/include/zix/filesystem.h
index 84d7206..dff4145 100644
--- a/include/zix/filesystem.h
+++ b/include/zix/filesystem.h
@@ -154,6 +154,17 @@ zix_remove(const char* ZIX_NONNULL path);
*/
/**
+ Function for reading input bytes from a stream.
+
+ @param path Path to the directory being visited.
+ @param name Name of the directory entry.
+ @param data Opaque user data.
+*/
+typedef void (*ZixDirEntryVisitFunc)(const char* ZIX_NONNULL path,
+ const char* ZIX_NONNULL name,
+ void* ZIX_NONNULL data);
+
+/**
Visit every file in the directory at `path`.
@param path A path to a directory.
@@ -165,11 +176,9 @@ zix_remove(const char* ZIX_NONNULL path);
parameter is the name of the directory entry (not its full path).
*/
ZIX_API void
-zix_dir_for_each(const char* ZIX_NONNULL path,
- void* ZIX_NULLABLE data,
- void (*ZIX_NONNULL f)(const char* ZIX_NONNULL path,
- const char* ZIX_NONNULL name,
- void* ZIX_NONNULL data));
+zix_dir_for_each(const char* ZIX_NONNULL path,
+ void* ZIX_NULLABLE data,
+ ZixDirEntryVisitFunc ZIX_NONNULL f);
/**
Return whether the given paths point to files with identical contents.
diff --git a/src/posix/filesystem_posix.c b/src/posix/filesystem_posix.c
index 7553916..2ee323a 100644
--- a/src/posix/filesystem_posix.c
+++ b/src/posix/filesystem_posix.c
@@ -300,11 +300,9 @@ zix_remove(const char* const path)
}
void
-zix_dir_for_each(const char* const path,
- void* const data,
- void (*const f)(const char* path,
- const char* name,
- void* data))
+zix_dir_for_each(const char* const path,
+ void* const data,
+ const ZixDirEntryVisitFunc f)
{
DIR* dir = opendir(path);
if (dir) {
diff --git a/src/win32/filesystem_win32.c b/src/win32/filesystem_win32.c
index 196818b..235ee0f 100644
--- a/src/win32/filesystem_win32.c
+++ b/src/win32/filesystem_win32.c
@@ -172,11 +172,9 @@ zix_remove(const char* const path)
}
void
-zix_dir_for_each(const char* const path,
- void* const data,
- void (*const f)(const char* path,
- const char* name,
- void* data))
+zix_dir_for_each(const char* const path,
+ void* const data,
+ const ZixDirEntryVisitFunc f)
{
static const TCHAR* const dot = TEXT(".");
static const TCHAR* const dotdot = TEXT("..");