diff options
author | David Robillard <d@drobilla.net> | 2022-11-02 15:50:51 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-11-02 15:50:51 -0400 |
commit | 30185a4d55786c2d649332fdcbd23e736f74dc80 (patch) | |
tree | 280b1c0ca5cf4bb8866d03d31744d616588c4335 /include | |
parent | 5590b407f8077c1ef0a25cd2948f973000b32683 (diff) | |
download | zix-30185a4d55786c2d649332fdcbd23e736f74dc80.tar.gz zix-30185a4d55786c2d649332fdcbd23e736f74dc80.tar.bz2 zix-30185a4d55786c2d649332fdcbd23e736f74dc80.zip |
Relax nullability constraints for BTree values
These pointers are truly opaque, the library does not care about their value at
all, and a zero can be stored successfully.
Diffstat (limited to 'include')
-rw-r--r-- | include/zix/attributes.h | 8 | ||||
-rw-r--r-- | include/zix/btree.h | 16 |
2 files changed, 13 insertions, 11 deletions
diff --git a/include/zix/attributes.h b/include/zix/attributes.h index b076fa7..dc367a1 100644 --- a/include/zix/attributes.h +++ b/include/zix/attributes.h @@ -83,10 +83,12 @@ # define ZIX_NONNULL _Nonnull # define ZIX_NULLABLE _Nullable # define ZIX_ALLOCATED _Null_unspecified +# define ZIX_UNSPECIFIED _Null_unspecified #else -# define ZIX_NONNULL ///< A non-null pointer -# define ZIX_NULLABLE ///< A nullable pointer -# define ZIX_ALLOCATED ///< An allocated (possibly null) pointer +# define ZIX_NONNULL ///< A non-null pointer +# define ZIX_NULLABLE ///< A nullable pointer +# define ZIX_ALLOCATED ///< An allocated (possibly null) pointer +# define ZIX_UNSPECIFIED ///< A pointer with unspecified nullability #endif /** diff --git a/include/zix/btree.h b/include/zix/btree.h index 7199dbc..05b520e 100644 --- a/include/zix/btree.h +++ b/include/zix/btree.h @@ -116,7 +116,7 @@ zix_btree_size(const ZixBTree* ZIX_NONNULL t); /// Insert the element `e` into `t` ZIX_API ZixStatus -zix_btree_insert(ZixBTree* ZIX_NONNULL t, void* ZIX_NULLABLE e); +zix_btree_insert(ZixBTree* ZIX_NONNULL t, void* ZIX_UNSPECIFIED e); /** Remove the value `e` from `t`. @@ -132,10 +132,10 @@ zix_btree_insert(ZixBTree* ZIX_NONNULL t, void* ZIX_NULLABLE e); */ ZIX_API ZixStatus -zix_btree_remove(ZixBTree* ZIX_NONNULL t, - const void* ZIX_NULLABLE e, - void* ZIX_NULLABLE* ZIX_NONNULL out, - ZixBTreeIter* ZIX_NONNULL next); +zix_btree_remove(ZixBTree* ZIX_NONNULL t, + const void* ZIX_UNSPECIFIED e, + void* ZIX_UNSPECIFIED* ZIX_NONNULL out, + ZixBTreeIter* ZIX_NONNULL next); /** Set `ti` to an element exactly equal to `e` in `t`. @@ -145,7 +145,7 @@ zix_btree_remove(ZixBTree* ZIX_NONNULL t, ZIX_API ZixStatus zix_btree_find(const ZixBTree* ZIX_NONNULL t, - const void* ZIX_NULLABLE e, + const void* ZIX_UNSPECIFIED e, ZixBTreeIter* ZIX_NONNULL ti); /** @@ -167,12 +167,12 @@ 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_NULLABLE key, + const void* ZIX_UNSPECIFIED key, ZixBTreeIter* ZIX_NONNULL ti); /// Return the data at the given position in the tree ZIX_PURE_API -void* ZIX_NULLABLE +void* ZIX_UNSPECIFIED zix_btree_get(ZixBTreeIter ti); /// Return an iterator to the first (smallest) element in `t` |