summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-10-20 21:34:22 -0400
committerDavid Robillard <d@drobilla.net>2022-10-21 12:45:39 -0400
commit2ff624eae24742faf17889f858dbdaa6d4a064ea (patch)
tree63fff58c10051292e82bb0b031f41d8769e56629 /include
parentd072adfbe40e15715e2065f1900f8d5a76491c5f (diff)
downloadzix-2ff624eae24742faf17889f858dbdaa6d4a064ea.tar.gz
zix-2ff624eae24742faf17889f858dbdaa6d4a064ea.tar.bz2
zix-2ff624eae24742faf17889f858dbdaa6d4a064ea.zip
Split up common header
Diffstat (limited to 'include')
-rw-r--r--include/zix/btree.h7
-rw-r--r--include/zix/function_types.h37
-rw-r--r--include/zix/hash.h2
-rw-r--r--include/zix/ring.h2
-rw-r--r--include/zix/sem.h2
-rw-r--r--include/zix/status.h (renamed from include/zix/common.h)25
-rw-r--r--include/zix/thread.h2
-rw-r--r--include/zix/tree.h5
8 files changed, 57 insertions, 25 deletions
diff --git a/include/zix/btree.h b/include/zix/btree.h
index 1b36908..33f47d1 100644
--- a/include/zix/btree.h
+++ b/include/zix/btree.h
@@ -6,7 +6,8 @@
#include "zix/allocator.h"
#include "zix/attributes.h"
-#include "zix/common.h"
+#include "zix/function_types.h"
+#include "zix/status.h"
#include <stdbool.h>
#include <stddef.h>
@@ -74,7 +75,7 @@ static const ZixBTreeIter zix_btree_end_iter = {
ZIX_API
ZixBTree* ZIX_ALLOCATED
zix_btree_new(ZixAllocator* ZIX_NULLABLE allocator,
- ZixComparator ZIX_NONNULL cmp,
+ ZixCompareFunc ZIX_NONNULL cmp,
const void* ZIX_NULLABLE cmp_data);
/**
@@ -166,7 +167,7 @@ zix_btree_find(const ZixBTree* ZIX_NONNULL t,
ZIX_API
ZixStatus
zix_btree_lower_bound(const ZixBTree* ZIX_NONNULL t,
- ZixComparator ZIX_NULLABLE compare_key,
+ ZixCompareFunc ZIX_NULLABLE compare_key,
const void* ZIX_NULLABLE compare_key_user_data,
const void* ZIX_NULLABLE key,
ZixBTreeIter* ZIX_NONNULL ti);
diff --git a/include/zix/function_types.h b/include/zix/function_types.h
new file mode 100644
index 0000000..8822847
--- /dev/null
+++ b/include/zix/function_types.h
@@ -0,0 +1,37 @@
+// 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>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ @defgroup zix_function_types Function Types
+ @ingroup zix
+ @{
+*/
+
+/// 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);
+
+/**
+ @}
+*/
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* ZIX_FUNCTION_TYPES_H */
diff --git a/include/zix/hash.h b/include/zix/hash.h
index c1521e0..397e055 100644
--- a/include/zix/hash.h
+++ b/include/zix/hash.h
@@ -6,7 +6,7 @@
#include "zix/allocator.h"
#include "zix/attributes.h"
-#include "zix/common.h"
+#include "zix/status.h"
#include <stdbool.h>
#include <stddef.h>
diff --git a/include/zix/ring.h b/include/zix/ring.h
index 6fb78ac..66662b7 100644
--- a/include/zix/ring.h
+++ b/include/zix/ring.h
@@ -6,7 +6,7 @@
#include "zix/allocator.h"
#include "zix/attributes.h"
-#include "zix/common.h"
+#include "zix/status.h"
#include <stdint.h>
diff --git a/include/zix/sem.h b/include/zix/sem.h
index 25088bf..3777497 100644
--- a/include/zix/sem.h
+++ b/include/zix/sem.h
@@ -5,7 +5,7 @@
#define ZIX_SEM_H
#include "zix/attributes.h"
-#include "zix/common.h"
+#include "zix/status.h"
#ifdef __APPLE__
# include <mach/mach.h>
diff --git a/include/zix/common.h b/include/zix/status.h
index 788fdaa..fcd45fb 100644
--- a/include/zix/common.h
+++ b/include/zix/status.h
@@ -1,22 +1,22 @@
// Copyright 2016-2022 David Robillard <d@drobilla.net>
// SPDX-License-Identifier: ISC
-#ifndef ZIX_COMMON_H
-#define ZIX_COMMON_H
+#ifndef ZIX_STATUS_H
+#define ZIX_STATUS_H
#include "zix/attributes.h"
-#include <stdbool.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
/**
@defgroup zix Zix C API
@{
+ @defgroup zix_status Status Codes
+ @{
*/
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/// A status code returned by functions
typedef enum {
ZIX_STATUS_SUCCESS, ///< Success
@@ -38,20 +38,13 @@ ZIX_CONST_API
const char*
zix_strerror(ZixStatus status);
-/// Function for comparing two elements
-typedef int (*ZixComparator)(const void* a,
- const void* b,
- const void* user_data);
-
-/// Function to destroy an element
-typedef void (*ZixDestroyFunc)(void* ptr, const void* user_data);
-
/**
@}
+ @}
*/
#ifdef __cplusplus
} /* extern "C" */
#endif
-#endif /* ZIX_COMMON_H */
+#endif /* ZIX_STATUS_H */
diff --git a/include/zix/thread.h b/include/zix/thread.h
index af036b1..14c525d 100644
--- a/include/zix/thread.h
+++ b/include/zix/thread.h
@@ -5,7 +5,7 @@
#define ZIX_THREAD_H
#include "zix/attributes.h"
-#include "zix/common.h"
+#include "zix/status.h"
#ifdef _WIN32
# include <windows.h>
diff --git a/include/zix/tree.h b/include/zix/tree.h
index f363ffc..7b77a7c 100644
--- a/include/zix/tree.h
+++ b/include/zix/tree.h
@@ -6,7 +6,8 @@
#include "zix/allocator.h"
#include "zix/attributes.h"
-#include "zix/common.h"
+#include "zix/function_types.h"
+#include "zix/status.h"
#include <stdbool.h>
#include <stddef.h>
@@ -32,7 +33,7 @@ ZIX_API
ZixTree* ZIX_ALLOCATED
zix_tree_new(ZixAllocator* ZIX_NULLABLE allocator,
bool allow_duplicates,
- ZixComparator ZIX_NONNULL cmp,
+ ZixCompareFunc ZIX_NONNULL cmp,
void* ZIX_NULLABLE cmp_data,
ZixDestroyFunc ZIX_NULLABLE destroy,
const void* ZIX_NULLABLE destroy_user_data);