summaryrefslogtreecommitdiffstats
path: root/include/zix/ring.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2024-11-15 08:53:26 -0500
committerDavid Robillard <d@drobilla.net>2024-11-15 08:53:26 -0500
commitc79edf4df9909bdb1313e74bb9cc7c8ea7936dcb (patch)
treea9a6642536eeb5860ae6c1eaaa74ba523385d7c8 /include/zix/ring.h
parent336aad280221ce643255032e948acccc27e7204f (diff)
downloadzix-c79edf4df9909bdb1313e74bb9cc7c8ea7936dcb.tar.gz
zix-c79edf4df9909bdb1313e74bb9cc7c8ea7936dcb.tar.bz2
zix-c79edf4df9909bdb1313e74bb9cc7c8ea7936dcb.zip
Update clang-format configuration
Diffstat (limited to 'include/zix/ring.h')
-rw-r--r--include/zix/ring.h44
1 files changed, 14 insertions, 30 deletions
diff --git a/include/zix/ring.h b/include/zix/ring.h
index db72f41..6829016 100644
--- a/include/zix/ring.h
+++ b/include/zix/ring.h
@@ -40,14 +40,11 @@ typedef struct ZixRingImpl ZixRing;
At most `size` - 1 bytes may be stored in the ring at once.
*/
-ZIX_API
-ZIX_NODISCARD
-ZixRing* ZIX_ALLOCATED
+ZIX_API ZIX_NODISCARD ZixRing* ZIX_ALLOCATED
zix_ring_new(ZixAllocator* ZIX_NULLABLE allocator, uint32_t size);
/// Destroy a ring
-ZIX_API
-void
+ZIX_API void
zix_ring_free(ZixRing* ZIX_NULLABLE ring);
/**
@@ -57,8 +54,7 @@ zix_ring_free(ZixRing* ZIX_NULLABLE ring);
after zix_ring_new() to lock all ring memory to avoid page faults while
using the ring.
*/
-ZIX_API
-ZixStatus
+ZIX_API ZixStatus
zix_ring_mlock(ZixRing* ZIX_NONNULL ring);
/**
@@ -67,8 +63,7 @@ zix_ring_mlock(ZixRing* ZIX_NONNULL ring);
This function is NOT thread-safe, it may only be called when there is no
reader or writer.
*/
-ZIX_API
-void
+ZIX_API void
zix_ring_reset(ZixRing* ZIX_NONNULL ring);
/**
@@ -77,8 +72,7 @@ zix_ring_reset(ZixRing* ZIX_NONNULL ring);
This function returns a constant for any given ring, and may (but usually
shouldn't) be called anywhere.
*/
-ZIX_PURE_API
-uint32_t
+ZIX_PURE_API uint32_t
zix_ring_capacity(const ZixRing* ZIX_NONNULL ring);
/**
@@ -89,23 +83,19 @@ zix_ring_capacity(const ZixRing* ZIX_NONNULL ring);
*/
/// Return the number of bytes available for reading
-ZIX_PURE_API
-uint32_t
+ZIX_PURE_API uint32_t
zix_ring_read_space(const ZixRing* ZIX_NONNULL ring);
/// Read from the ring without advancing the read head
-ZIX_API
-uint32_t
+ZIX_API uint32_t
zix_ring_peek(ZixRing* ZIX_NONNULL ring, void* ZIX_NONNULL dst, uint32_t size);
/// Read from the ring and advance the read head
-ZIX_API
-uint32_t
+ZIX_API uint32_t
zix_ring_read(ZixRing* ZIX_NONNULL ring, void* ZIX_NONNULL dst, uint32_t size);
/// Advance the read head, ignoring any data
-ZIX_API
-uint32_t
+ZIX_API uint32_t
zix_ring_skip(ZixRing* ZIX_NONNULL ring, uint32_t size);
/**
@@ -130,13 +120,11 @@ typedef struct {
} ZixRingTransaction;
/// Return the number of bytes available for writing
-ZIX_PURE_API
-uint32_t
+ZIX_PURE_API uint32_t
zix_ring_write_space(const ZixRing* ZIX_NONNULL ring);
/// Write data to the ring
-ZIX_API
-uint32_t
+ZIX_API uint32_t
zix_ring_write(ZixRing* ZIX_NONNULL ring,
const void* ZIX_NONNULL src,
uint32_t size);
@@ -155,9 +143,7 @@ zix_ring_write(ZixRing* ZIX_NONNULL ring,
@param ring The ring to write data to.
@return A new empty transaction.
*/
-ZIX_API
-ZIX_NODISCARD
-ZixRingTransaction
+ZIX_API ZIX_NODISCARD ZixRingTransaction
zix_ring_begin_write(ZixRing* ZIX_NONNULL ring);
/**
@@ -178,8 +164,7 @@ zix_ring_begin_write(ZixRing* ZIX_NONNULL ring);
@param size Length of data to write in bytes.
@return #ZIX_STATUS_NO_MEM or #ZIX_STATUS_SUCCESS.
*/
-ZIX_API
-ZixStatus
+ZIX_API ZixStatus
zix_ring_amend_write(ZixRing* ZIX_NONNULL ring,
ZixRingTransaction* ZIX_NONNULL tx,
const void* ZIX_NONNULL src,
@@ -198,8 +183,7 @@ zix_ring_amend_write(ZixRing* ZIX_NONNULL ring,
@param tx The active transaction, from zix_ring_begin_write().
@return #ZIX_STATUS_SUCCESS.
*/
-ZIX_API
-ZixStatus
+ZIX_API ZixStatus
zix_ring_commit_write(ZixRing* ZIX_NONNULL ring,
const ZixRingTransaction* ZIX_NONNULL tx);