diff options
author | David Robillard <d@drobilla.net> | 2019-10-14 19:18:17 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-10-27 13:13:58 +0100 |
commit | 0e8a72aae08b64beb11d97f020c14126178d7545 (patch) | |
tree | 0cf783d174f2ddd95453c34aba3ef46fc3a5b9d7 /serd | |
parent | 3ff6565bdf0861f9db3527b58919ca7481deca6c (diff) | |
download | serd-0e8a72aae08b64beb11d97f020c14126178d7545.tar.gz serd-0e8a72aae08b64beb11d97f020c14126178d7545.tar.bz2 serd-0e8a72aae08b64beb11d97f020c14126178d7545.zip |
Add function to SerdSink for freeing opaque handle
This can be used to associate dynamically allocated data with a sink and have
it managed along with the sink's lifetime.
Diffstat (limited to 'serd')
-rw-r--r-- | serd/serd.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/serd/serd.h b/serd/serd.h index e471988c..72e64c20 100644 --- a/serd/serd.h +++ b/serd/serd.h @@ -1014,6 +1014,9 @@ serd_env_write_prefixes(const SerdEnv* env, const SerdSink* sink); @{ */ +/// Function to free an opaque handle +typedef void (*SerdFreeFunc)(void* ptr); + /** Create a new sink @@ -1021,10 +1024,11 @@ serd_env_write_prefixes(const SerdEnv* env, const SerdSink* sink); serd_sink_set_*_func functions to set handlers for various events. @param handle Opaque handle that will be passed to sink functions. + @param free_handle Free function to call on handle in serd_sink_free(). */ SERD_API SerdSink* -serd_sink_new(void* handle); +serd_sink_new(void* handle, SerdFreeFunc free_handle); /// Free `sink` SERD_API |