diff options
author | David Robillard <d@drobilla.net> | 2022-11-02 16:30:44 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-11-02 17:31:55 -0400 |
commit | dedf8b645ad676e7947c83f320198d43f4341570 (patch) | |
tree | d0bb9cf6033437020e8e75aa8f7d6bbe8b4b51c0 /include/zix | |
parent | 4f454ff117cac82c4ce86fc22d37fd317e925a18 (diff) | |
download | zix-dedf8b645ad676e7947c83f320198d43f4341570.tar.gz zix-dedf8b645ad676e7947c83f320198d43f4341570.tar.bz2 zix-dedf8b645ad676e7947c83f320198d43f4341570.zip |
Remove function_types.h
Diffstat (limited to 'include/zix')
-rw-r--r-- | include/zix/btree.h | 38 | ||||
-rw-r--r-- | include/zix/function_types.h | 33 | ||||
-rw-r--r-- | include/zix/tree.h | 22 | ||||
-rw-r--r-- | include/zix/zix.h | 1 |
4 files changed, 38 insertions, 56 deletions
diff --git a/include/zix/btree.h b/include/zix/btree.h index 05b520e..f3b365a 100644 --- a/include/zix/btree.h +++ b/include/zix/btree.h @@ -6,7 +6,6 @@ #include "zix/allocator.h" #include "zix/attributes.h" -#include "zix/function_types.h" #include "zix/status.h" #include <stdbool.h> @@ -40,6 +39,15 @@ typedef struct ZixBTreeImpl ZixBTree; /// A B-Tree node (opaque) typedef struct ZixBTreeNodeImpl ZixBTreeNode; +/// Function for comparing two B-Tree elements +typedef int (*ZixBTreeCompareFunc)(const void* ZIX_UNSPECIFIED a, + const void* ZIX_UNSPECIFIED b, + const void* ZIX_UNSPECIFIED user_data); + +/// Function to destroy a B-Tree element +typedef void (*ZixBTreeDestroyFunc)(void* ZIX_UNSPECIFIED ptr, + const void* ZIX_UNSPECIFIED user_data); + /** An iterator over a B-Tree. @@ -72,9 +80,9 @@ static const ZixBTreeIter zix_btree_end_iter = { */ ZIX_API ZixBTree* ZIX_ALLOCATED -zix_btree_new(ZixAllocator* ZIX_NULLABLE allocator, - ZixCompareFunc ZIX_NONNULL cmp, - const void* ZIX_NULLABLE cmp_data); +zix_btree_new(ZixAllocator* ZIX_NULLABLE allocator, + ZixBTreeCompareFunc ZIX_NONNULL cmp, + const void* ZIX_UNSPECIFIED cmp_data); /** Free `t` and all the nodes it contains. @@ -88,9 +96,9 @@ zix_btree_new(ZixAllocator* ZIX_NULLABLE allocator, */ ZIX_API void -zix_btree_free(ZixBTree* ZIX_NULLABLE t, - ZixDestroyFunc ZIX_NULLABLE destroy, - const void* ZIX_NULLABLE destroy_user_data); +zix_btree_free(ZixBTree* ZIX_NULLABLE t, + ZixBTreeDestroyFunc ZIX_NULLABLE destroy, + const void* ZIX_NULLABLE destroy_user_data); /** Clear everything from `t`, leaving it empty. @@ -104,9 +112,9 @@ zix_btree_free(ZixBTree* ZIX_NULLABLE t, */ ZIX_API void -zix_btree_clear(ZixBTree* ZIX_NONNULL t, - ZixDestroyFunc ZIX_NULLABLE destroy, - const void* ZIX_NULLABLE destroy_user_data); +zix_btree_clear(ZixBTree* ZIX_NONNULL t, + ZixBTreeDestroyFunc ZIX_NULLABLE destroy, + const void* ZIX_NULLABLE destroy_user_data); /// Return the number of elements in `t` ZIX_PURE_API @@ -164,11 +172,11 @@ zix_btree_find(const ZixBTree* ZIX_NONNULL t, */ ZIX_API ZixStatus -zix_btree_lower_bound(const ZixBTree* ZIX_NONNULL t, - ZixCompareFunc ZIX_NULLABLE compare_key, - const void* ZIX_NULLABLE compare_key_user_data, - const void* ZIX_UNSPECIFIED key, - ZixBTreeIter* ZIX_NONNULL ti); +zix_btree_lower_bound(const ZixBTree* ZIX_NONNULL t, + ZixBTreeCompareFunc ZIX_NULLABLE compare_key, + const void* ZIX_NULLABLE compare_key_user_data, + const void* ZIX_UNSPECIFIED key, + ZixBTreeIter* ZIX_NONNULL ti); /// Return the data at the given position in the tree ZIX_PURE_API diff --git a/include/zix/function_types.h b/include/zix/function_types.h deleted file mode 100644 index d0c7193..0000000 --- a/include/zix/function_types.h +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2016-2022 David Robillard <d@drobilla.net> -// SPDX-License-Identifier: ISC - -#ifndef ZIX_FUNCTION_TYPES_H -#define ZIX_FUNCTION_TYPES_H - -#include "zix/attributes.h" - -#include <stdbool.h> - -ZIX_BEGIN_DECLS - -/** - @defgroup zix_function_types Function Types - @ingroup zix_utilities - @{ -*/ - -/// Function for comparing two elements -typedef int (*ZixCompareFunc)(const void* a, - const void* b, - const void* user_data); - -/// Function to destroy an element -typedef void (*ZixDestroyFunc)(void* ptr, const void* user_data); - -/** - @} -*/ - -ZIX_END_DECLS - -#endif /* ZIX_FUNCTION_TYPES_H */ diff --git a/include/zix/tree.h b/include/zix/tree.h index 8114c97..1b5c4ec 100644 --- a/include/zix/tree.h +++ b/include/zix/tree.h @@ -6,7 +6,6 @@ #include "zix/allocator.h" #include "zix/attributes.h" -#include "zix/function_types.h" #include "zix/status.h" #include <stdbool.h> @@ -26,15 +25,24 @@ typedef struct ZixTreeImpl ZixTree; /// An iterator over a @ref ZixTree typedef struct ZixTreeNodeImpl ZixTreeIter; +/// Function for comparing two Tree elements +typedef int (*ZixTreeCompareFunc)(const void* ZIX_UNSPECIFIED a, + const void* ZIX_UNSPECIFIED b, + const void* ZIX_UNSPECIFIED user_data); + +/// Function to destroy a Tree element +typedef void (*ZixTreeDestroyFunc)(void* ZIX_UNSPECIFIED ptr, + const void* ZIX_UNSPECIFIED user_data); + /// Create a new (empty) tree ZIX_API ZixTree* ZIX_ALLOCATED -zix_tree_new(ZixAllocator* ZIX_NULLABLE allocator, - bool allow_duplicates, - ZixCompareFunc ZIX_NONNULL cmp, - void* ZIX_UNSPECIFIED cmp_data, - ZixDestroyFunc ZIX_NULLABLE destroy, - const void* ZIX_NULLABLE destroy_user_data); +zix_tree_new(ZixAllocator* ZIX_NULLABLE allocator, + bool allow_duplicates, + ZixTreeCompareFunc ZIX_NONNULL cmp, + void* ZIX_UNSPECIFIED cmp_data, + ZixTreeDestroyFunc ZIX_NULLABLE destroy, + const void* ZIX_NULLABLE destroy_user_data); /// Free `t` ZIX_API diff --git a/include/zix/zix.h b/include/zix/zix.h index b144cee..db54ce4 100644 --- a/include/zix/zix.h +++ b/include/zix/zix.h @@ -18,7 +18,6 @@ #include "zix/attributes.h" #include "zix/digest.h" -#include "zix/function_types.h" #include "zix/status.h" #include "zix/string_view.h" |