summaryrefslogtreecommitdiffstats
path: root/include/zix/path.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2024-12-11 01:01:58 -0500
committerDavid Robillard <d@drobilla.net>2024-12-11 01:01:58 -0500
commit158e199d0dbc54fe497a53b167c880a8c85a9017 (patch)
treebee7f1aba5c59b4c0ba5a13e68ad8ba9bd7d51c0 /include/zix/path.h
parent333e0e57888b85df95e319a41a07ee5381b2b117 (diff)
downloadzix-158e199d0dbc54fe497a53b167c880a8c85a9017.tar.gz
zix-158e199d0dbc54fe497a53b167c880a8c85a9017.tar.bz2
zix-158e199d0dbc54fe497a53b167c880a8c85a9017.zip
Consistently use malloc attribute for string-returning functions
These function return newly allocated strings, which can't contain pointers to any other object, so the GCC "malloc" attribute applies.
Diffstat (limited to 'include/zix/path.h')
-rw-r--r--include/zix/path.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/include/zix/path.h b/include/zix/path.h
index 692efef..69b2897 100644
--- a/include/zix/path.h
+++ b/include/zix/path.h
@@ -35,7 +35,7 @@ ZIX_BEGIN_DECLS
*/
/// Join path `a` and path `b` with a single directory separator between them
-ZIX_API ZIX_NODISCARD char* ZIX_ALLOCATED
+ZIX_MALLOC_API ZIX_NODISCARD char* ZIX_ALLOCATED
zix_path_join(ZixAllocator* ZIX_NULLABLE allocator,
const char* ZIX_NULLABLE a,
const char* ZIX_NULLABLE b);
@@ -53,7 +53,7 @@ zix_path_join(ZixAllocator* ZIX_NULLABLE allocator,
converted to the preferred separator (backslash on Windows, slash everywhere
else).
*/
-ZIX_API ZIX_NODISCARD char* ZIX_ALLOCATED
+ZIX_MALLOC_API ZIX_NODISCARD char* ZIX_ALLOCATED
zix_path_preferred(ZixAllocator* ZIX_NULLABLE allocator,
const char* ZIX_NONNULL path);
@@ -68,7 +68,7 @@ zix_path_preferred(ZixAllocator* ZIX_NULLABLE allocator,
like case normalization or symbolic link dereferencing. For that, use
zix_canonical_path().
*/
-ZIX_API ZIX_NODISCARD char* ZIX_ALLOCATED
+ZIX_MALLOC_API ZIX_NODISCARD char* ZIX_ALLOCATED
zix_path_lexically_normal(ZixAllocator* ZIX_NULLABLE allocator,
const char* ZIX_NONNULL path);
@@ -79,7 +79,7 @@ zix_path_lexically_normal(ZixAllocator* ZIX_NULLABLE allocator,
equivalent path relative to `base` is returned (which may contain
up-references).
*/
-ZIX_API ZIX_NODISCARD char* ZIX_ALLOCATED
+ZIX_MALLOC_API ZIX_NODISCARD char* ZIX_ALLOCATED
zix_path_lexically_relative(ZixAllocator* ZIX_NULLABLE allocator,
const char* ZIX_NONNULL path,
const char* ZIX_NONNULL base);