From c5c23c3e27ab765c8df28088fbec5f41b89bb8b8 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 11 Dec 2024 00:12:20 -0500 Subject: Add ZixDirEntryVisitFunc Although this type is only used once in the API, define it to avoid the complicated syntax of inline function pointer parameters, which confuses both people and clang-format. --- include/zix/filesystem.h | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'include/zix') 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 @@ -153,6 +153,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`. @@ -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. -- cgit v1.2.1