summaryrefslogtreecommitdiffstats
path: root/src/posix/filesystem_posix.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/posix/filesystem_posix.c')
-rw-r--r--src/posix/filesystem_posix.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/posix/filesystem_posix.c b/src/posix/filesystem_posix.c
index be13995..ea091e0 100644
--- a/src/posix/filesystem_posix.c
+++ b/src/posix/filesystem_posix.c
@@ -1,15 +1,15 @@
// Copyright 2007-2022 David Robillard <d@drobilla.net>
// SPDX-License-Identifier: ISC
-#include "zix/filesystem.h"
+#include <zix/filesystem.h>
#include "../errno_status.h"
#include "../system.h"
#include "../zix_config.h"
-#include "zix/allocator.h"
-#include "zix/attributes.h"
-#include "zix/status.h"
+#include <zix/allocator.h>
+#include <zix/attributes.h>
+#include <zix/status.h>
#if USE_FLOCK && USE_FILENO
# include <sys/file.h>
@@ -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) {
@@ -343,6 +341,9 @@ zix_canonical_path(ZixAllocator* const allocator, const char* const path)
}
zix_free(allocator, buffer);
+
+#else
+ (void)allocator;
#endif
return NULL;
@@ -351,7 +352,7 @@ zix_canonical_path(ZixAllocator* const allocator, const char* const path)
ZixStatus
zix_file_lock(FILE* const file, const ZixFileLockMode mode)
{
-#if !defined(__EMSCRIPTEN__) && USE_FLOCK && USE_FILENO
+#if USE_FLOCK && USE_FILENO
return zix_posix_status(
flock(fileno(file),
(mode == ZIX_FILE_LOCK_BLOCK) ? LOCK_EX : (LOCK_EX | LOCK_NB)));
@@ -366,7 +367,7 @@ zix_file_lock(FILE* const file, const ZixFileLockMode mode)
ZixStatus
zix_file_unlock(FILE* const file, const ZixFileLockMode mode)
{
-#if !defined(__EMSCRIPTEN__) && USE_FLOCK && USE_FILENO
+#if USE_FLOCK && USE_FILENO
return zix_posix_status(
flock(fileno(file),
(mode == ZIX_FILE_LOCK_BLOCK) ? LOCK_UN : (LOCK_UN | LOCK_NB)));
@@ -378,8 +379,7 @@ zix_file_unlock(FILE* const file, const ZixFileLockMode mode)
#endif
}
-ZIX_CONST_FUNC
-static ZixFileType
+ZIX_CONST_FUNC static ZixFileType
stat_file_type(const struct stat* sb)
{
typedef struct {
@@ -452,6 +452,7 @@ zix_current_path(ZixAllocator* const allocator)
return current;
#else
+ (void)allocator;
return NULL;
#endif