summaryrefslogtreecommitdiffstats
path: root/include/zix
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-09-10 20:11:40 -0400
committerDavid Robillard <d@drobilla.net>2021-09-10 20:54:28 -0400
commit06443ecb437eebcf3373b1034ca5ff84ebe212df (patch)
tree89c4c0d72eac6b10d88bf1042584d84cf9fc607f /include/zix
parent6d4cb50fa2f2cdd092e9459a6da59eb3cdda7434 (diff)
downloadzix-06443ecb437eebcf3373b1034ca5ff84ebe212df.tar.gz
zix-06443ecb437eebcf3373b1034ca5ff84ebe212df.tar.bz2
zix-06443ecb437eebcf3373b1034ca5ff84ebe212df.zip
Add a user handle to destroy callback
Diffstat (limited to 'include/zix')
-rw-r--r--include/zix/btree.h8
-rw-r--r--include/zix/common.h2
-rw-r--r--include/zix/tree.h3
3 files changed, 9 insertions, 4 deletions
diff --git a/include/zix/btree.h b/include/zix/btree.h
index d19da3c..07de8c3 100644
--- a/include/zix/btree.h
+++ b/include/zix/btree.h
@@ -95,7 +95,9 @@ zix_btree_new(ZixComparator cmp, const void* cmp_data);
*/
ZIX_API
void
-zix_btree_free(ZixBTree* t, ZixDestroyFunc destroy);
+zix_btree_free(ZixBTree* t,
+ ZixDestroyFunc destroy,
+ const void* destroy_user_data);
/**
Clear everything from `t`, leaving it empty.
@@ -105,7 +107,9 @@ zix_btree_free(ZixBTree* t, ZixDestroyFunc destroy);
*/
ZIX_API
void
-zix_btree_clear(ZixBTree* t, ZixDestroyFunc destroy);
+zix_btree_clear(ZixBTree* t,
+ ZixDestroyFunc destroy,
+ const void* destroy_user_data);
/// Return the number of elements in `t`
ZIX_PURE_API
diff --git a/include/zix/common.h b/include/zix/common.h
index 02f00b4..f43fcde 100644
--- a/include/zix/common.h
+++ b/include/zix/common.h
@@ -124,7 +124,7 @@ typedef int (*ZixComparator)(const void* a,
typedef bool (*ZixEqualFunc)(const void* a, const void* b);
/// Function to destroy an element
-typedef void (*ZixDestroyFunc)(void* ptr);
+typedef void (*ZixDestroyFunc)(void* ptr, const void* user_data);
/**
@}
diff --git a/include/zix/tree.h b/include/zix/tree.h
index d7d2cce..e0daa80 100644
--- a/include/zix/tree.h
+++ b/include/zix/tree.h
@@ -45,7 +45,8 @@ ZixTree*
zix_tree_new(bool allow_duplicates,
ZixComparator cmp,
void* cmp_data,
- ZixDestroyFunc destroy);
+ ZixDestroyFunc destroy,
+ const void* destroy_user_data);
/// Free `t`
ZIX_API