diff options
author | David Robillard <d@drobilla.net> | 2021-09-10 13:20:47 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-01-28 21:57:07 -0500 |
commit | eb804125430e3445e85c423b28e1c41346772ed0 (patch) | |
tree | 532f6995ace537170fbbfde2d0d8226d1a48279b /include | |
parent | cbf01be4126cbc0f6d80364a7e0b6ad777a7d8ae (diff) | |
download | serd-eb804125430e3445e85c423b28e1c41346772ed0.tar.gz serd-eb804125430e3445e85c423b28e1c41346772ed0.tar.bz2 serd-eb804125430e3445e85c423b28e1c41346772ed0.zip |
Make environments and sinks part of the world
Although functions/components that require minimal pre-existing state are nice,
these allocate memory and could potentially share resources. So, give them a
pointer to a world which can be used to configure such things. In particular,
this is working towards supporting custom allocators everywhere.
Diffstat (limited to 'include')
-rw-r--r-- | include/serd/serd.h | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/include/serd/serd.h b/include/serd/serd.h index 35d31a57..9e322c0d 100644 --- a/include/serd/serd.h +++ b/include/serd/serd.h @@ -1917,15 +1917,17 @@ typedef void (*SerdFreeFunc)(void* SERD_NULLABLE ptr); /** Create a new sink. + @param world The world the new sink will be a part of. @param handle Opaque handle that will be passed to sink functions. @param event_func Function that will be called for every event. @param free_handle Free function to call on handle in serd_sink_free(). */ SERD_API SerdSink* SERD_ALLOCATED -serd_sink_new(void* SERD_NULLABLE handle, - SerdEventFunc SERD_NULLABLE event_func, - SerdFreeFunc SERD_NULLABLE free_handle); +serd_sink_new(const SerdWorld* SERD_NONNULL world, + void* SERD_NULLABLE handle, + SerdEventFunc SERD_NULLABLE event_func, + SerdFreeFunc SERD_NULLABLE free_handle); /// Free `sink` SERD_API @@ -1996,9 +1998,9 @@ typedef uint32_t SerdCanonFlags; */ SERD_API SerdSink* SERD_ALLOCATED -serd_canon_new(const SerdWorld* SERD_NULLABLE world, - const SerdSink* SERD_NONNULL target, - SerdCanonFlags flags); +serd_canon_new(const SerdWorld* SERD_NONNULL world, + const SerdSink* SERD_NONNULL target, + SerdCanonFlags flags); /** @} @@ -2012,6 +2014,8 @@ serd_canon_new(const SerdWorld* SERD_NULLABLE world, The returned sink acts like `target` in all respects, except that some statements may be dropped. + @param world The world the new sink will be a part of. + @param target The target sink to pass the filtered data to. @param subject The optional subject of the filter pattern. @@ -2028,7 +2032,8 @@ serd_canon_new(const SerdWorld* SERD_NULLABLE world, */ SERD_API SerdSink* SERD_ALLOCATED -serd_filter_new(const SerdSink* SERD_NONNULL target, +serd_filter_new(const SerdWorld* SERD_NONNULL world, + const SerdSink* SERD_NONNULL target, const SerdNode* SERD_NULLABLE subject, const SerdNode* SERD_NULLABLE predicate, const SerdNode* SERD_NULLABLE object, @@ -2047,7 +2052,7 @@ typedef struct SerdEnvImpl SerdEnv; /// Create a new environment SERD_API SerdEnv* SERD_ALLOCATED -serd_env_new(SerdStringView base_uri); +serd_env_new(SerdWorld* SERD_NONNULL world, SerdStringView base_uri); /// Copy an environment SERD_API |