diff options
author | David Robillard <d@drobilla.net> | 2011-09-15 14:48:14 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-09-15 14:48:14 +0000 |
commit | 4547add54e051067e450ad13115d7b864c14a384 (patch) | |
tree | 241cd7cc15c3aef119d9087df8d03a012786e0a4 /zix | |
parent | d7d36c2a5899818827c72a2cbb2ea0626a238f15 (diff) | |
download | zix-4547add54e051067e450ad13115d7b864c14a384.tar.gz zix-4547add54e051067e450ad13115d7b864c14a384.tar.bz2 zix-4547add54e051067e450ad13115d7b864c14a384.zip |
Make tree methods return ZixStatus instead of int where appropriate.
Move ZixComparator to common.h.
git-svn-id: http://svn.drobilla.net/zix/trunk@8 df6676b4-ccc9-40e5-b5d6-7c4628a128e3
Diffstat (limited to 'zix')
-rw-r--r-- | zix/common.h | 5 | ||||
-rw-r--r-- | zix/tree.h | 22 |
2 files changed, 18 insertions, 9 deletions
diff --git a/zix/common.h b/zix/common.h index dd86a8b..ee18664 100644 --- a/zix/common.h +++ b/zix/common.h @@ -48,6 +48,11 @@ typedef enum { } ZixStatus; /** + Function for comparing two elements. +*/ +typedef int (*ZixComparator)(const void* a, const void* b, void* user_data); + +/** @} */ @@ -33,11 +33,6 @@ extern "C" { */ /** - Function for comparing two elements. -*/ -typedef int (*ZixComparator)(const void* a, const void* b, void* user_data); - -/** A balanced binary search tree. */ typedef struct ZixTreeImpl ZixTree; @@ -67,24 +62,24 @@ zix_tree_free(ZixTree* t); /** Insert the element @a e into @a t and point @a ti at the new element. */ -int +ZixStatus zix_tree_insert(ZixTree* t, const void* e, ZixTreeIter* ti); /** Remove the item pointed at by @a ti from @a t. */ -int +ZixStatus zix_tree_remove(ZixTree* t, ZixTreeIter ti); /** Set @a ti to be the largest element <= @a e in @a t. If no such item exists, @a ti is set to NULL. */ -int +ZixStatus zix_tree_find(const ZixTree* t, const void* e, ZixTreeIter* ti); /** - Return the data associated with the given avltree item. + Return the data associated with the given tree item. */ const void* zix_tree_get_data(ZixTreeIter ti); @@ -95,12 +90,21 @@ zix_tree_get_data(ZixTreeIter ti); ZixTreeIter zix_tree_begin(ZixTree* t); +/** + Return an iterator the the element one past the last element in @a t. +*/ ZixTreeIter zix_tree_end(ZixTree* t); +/** + Return true iff @a i is an iterator to the end of its tree. +*/ bool zix_tree_iter_is_end(ZixTreeIter i); +/** + Return an iterator that points to the element one past @a i. +*/ ZixTreeIter zix_tree_iter_next(ZixTreeIter i); |