diff options
author | David Robillard <d@drobilla.net> | 2023-09-10 15:06:42 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-12-02 18:49:08 -0500 |
commit | 248a874d7425749d29cf900a1c3783c624ea8d8c (patch) | |
tree | aed59f5a484a815cd254506866e98a947858904d /include/serd/uri.h | |
parent | 0bd10132c6707353dba80bd89cf0102ee7ca4e34 (diff) | |
download | serd-248a874d7425749d29cf900a1c3783c624ea8d8c.tar.gz serd-248a874d7425749d29cf900a1c3783c624ea8d8c.tar.bz2 serd-248a874d7425749d29cf900a1c3783c624ea8d8c.zip |
Add support for custom allocators
This makes it explicit in the API where memory is allocated, and allows the
user to provide a custom allocator to avoid the use of the default system
allocator for whatever reason.
Diffstat (limited to 'include/serd/uri.h')
-rw-r--r-- | include/serd/uri.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/include/serd/uri.h b/include/serd/uri.h index 7a63f183..c978782f 100644 --- a/include/serd/uri.h +++ b/include/serd/uri.h @@ -5,6 +5,7 @@ #define SERD_URI_H #include "serd/attributes.h" +#include "serd/memory.h" #include "serd/stream.h" #include "serd/string_view.h" #include "zix/attributes.h" @@ -55,12 +56,15 @@ static const SerdURIView SERD_URI_NULL = The returned path and `*hostname` must be freed with serd_free(). + @param allocator Allocator for the returned string. @param uri A file URI. @param hostname If non-NULL, set to the hostname, if present. - @return A newly-allocated filesystem path. + + @return A newly allocated path string that must be freed with serd_free(). */ SERD_API char* ZIX_ALLOCATED -serd_parse_file_uri(const char* ZIX_NONNULL uri, +serd_parse_file_uri(SerdAllocator* ZIX_NULLABLE allocator, + const char* ZIX_NONNULL uri, char* ZIX_NONNULL* ZIX_NULLABLE hostname); /// Return true iff `string` starts with a valid URI scheme |