src/cx/buffer.h

changeset 1426
3a89b31f0724
parent 1424
563033aa998c
--- a/src/cx/buffer.h	Wed Oct 15 22:45:21 2025 +0200
+++ b/src/cx/buffer.h	Thu Oct 16 19:57:47 2025 +0200
@@ -227,14 +227,8 @@
  * @return zero on success, non-zero if a required allocation failed
  */
 cx_attr_nonnull_arg(1)
-cx_attr_export
-int cxBufferInit(
-        CxBuffer *buffer,
-        void *space,
-        size_t capacity,
-        const CxAllocator *allocator,
-        int flags
-);
+CX_EXPORT int cxBufferInit(CxBuffer *buffer, void *space, size_t capacity,
+        const CxAllocator *allocator, int flags);
 
 /**
  * Configures the buffer for flushing.
@@ -251,11 +245,7 @@
  * @see cxBufferWrite()
  */
 cx_attr_nonnull
-cx_attr_export
-int cxBufferEnableFlushing(
-    CxBuffer *buffer,
-    CxBufferFlushConfig config
-);
+CX_EXPORT int cxBufferEnableFlushing(CxBuffer *buffer, CxBufferFlushConfig config);
 
 /**
  * Destroys the buffer contents.
@@ -267,8 +257,7 @@
  * @see cxBufferInit()
  */
 cx_attr_nonnull
-cx_attr_export
-void cxBufferDestroy(CxBuffer *buffer);
+CX_EXPORT void cxBufferDestroy(CxBuffer *buffer);
 
 /**
  * Deallocates the buffer.
@@ -279,8 +268,7 @@
  * @param buffer the buffer to deallocate
  * @see cxBufferCreate()
  */
-cx_attr_export
-void cxBufferFree(CxBuffer *buffer);
+CX_EXPORT void cxBufferFree(CxBuffer *buffer);
 
 /**
  * Allocates and initializes a fresh buffer.
@@ -306,16 +294,9 @@
  * @param flags buffer features (see cx_buffer_s.flags)
  * @return a pointer to the buffer on success, @c NULL if a required allocation failed
  */
-cx_attr_malloc
-cx_attr_dealloc(cxBufferFree, 1)
-cx_attr_nodiscard
-cx_attr_export
-CxBuffer *cxBufferCreate(
-        void *space,
-        size_t capacity,
-        const CxAllocator *allocator,
-        int flags
-);
+cx_attr_malloc cx_attr_dealloc(cxBufferFree, 1) cx_attr_nodiscard
+CX_EXPORT CxBuffer *cxBufferCreate(void *space, size_t capacity,
+        const CxAllocator *allocator, int flags);
 
 /**
  * Shifts the contents of the buffer by the given offset.
@@ -354,11 +335,7 @@
  * @see cxBufferShiftRight()
  */
 cx_attr_nonnull
-cx_attr_export
-int cxBufferShift(
-        CxBuffer *buffer,
-        off_t shift
-);
+CX_EXPORT int cxBufferShift(CxBuffer *buffer, off_t shift);
 
 /**
  * Shifts the buffer to the right.
@@ -371,11 +348,7 @@
  * @see cxBufferShift()
  */
 cx_attr_nonnull
-cx_attr_export
-int cxBufferShiftRight(
-        CxBuffer *buffer,
-        size_t shift
-);
+CX_EXPORT int cxBufferShiftRight(CxBuffer *buffer, size_t shift);
 
 /**
  * Shifts the buffer to the left.
@@ -388,11 +361,7 @@
  * @see cxBufferShift()
  */
 cx_attr_nonnull
-cx_attr_export
-int cxBufferShiftLeft(
-        CxBuffer *buffer,
-        size_t shift
-);
+CX_EXPORT int cxBufferShiftLeft(CxBuffer *buffer, size_t shift);
 
 
 /**
@@ -416,12 +385,7 @@
  *
  */
 cx_attr_nonnull
-cx_attr_export
-int cxBufferSeek(
-        CxBuffer *buffer,
-        off_t offset,
-        int whence
-);
+CX_EXPORT int cxBufferSeek(CxBuffer *buffer, off_t offset, int whence);
 
 /**
  * Clears the buffer by resetting the position and deleting the data.
@@ -436,8 +400,7 @@
  * @see cxBufferReset()
  */
 cx_attr_nonnull
-cx_attr_export
-void cxBufferClear(CxBuffer *buffer);
+CX_EXPORT void cxBufferClear(CxBuffer *buffer);
 
 /**
  * Resets the buffer by resetting the position and size to zero.
@@ -449,8 +412,7 @@
  * @see cxBufferClear()
  */
 cx_attr_nonnull
-cx_attr_export
-void cxBufferReset(CxBuffer *buffer);
+CX_EXPORT void cxBufferReset(CxBuffer *buffer);
 
 /**
  * Tests, if the buffer position has exceeded the buffer size.
@@ -460,10 +422,8 @@
  * byte of the buffer's contents
  * @retval false otherwise
  */
-cx_attr_nonnull
-cx_attr_nodiscard
-cx_attr_export
-bool cxBufferEof(const CxBuffer *buffer);
+cx_attr_nonnull cx_attr_nodiscard
+CX_EXPORT bool cxBufferEof(const CxBuffer *buffer);
 
 
 /**
@@ -481,11 +441,7 @@
  * @see cxBufferShrink()
  */
 cx_attr_nonnull
-cx_attr_export
-int cxBufferMinimumCapacity(
-        CxBuffer *buffer,
-        size_t capacity
-);
+CX_EXPORT int cxBufferMinimumCapacity(CxBuffer *buffer, size_t capacity);
 
 /**
  * Shrinks the capacity of the buffer to fit its current size.
@@ -504,11 +460,7 @@
  * @see cxBufferMinimumCapacity()
  */
 cx_attr_nonnull
-cx_attr_export
-void cxBufferShrink(
-        CxBuffer *buffer,
-        size_t reserve
-);
+CX_EXPORT void cxBufferShrink(CxBuffer *buffer, size_t reserve);
 
 /**
  * Writes data to a CxBuffer.
@@ -552,13 +504,8 @@
  * @see cxBufferRead()
  */
 cx_attr_nonnull
-cx_attr_export
-size_t cxBufferWrite(
-        const void *ptr,
-        size_t size,
-        size_t nitems,
-        CxBuffer *buffer
-);
+CX_EXPORT size_t cxBufferWrite(const void *ptr, size_t size,
+        size_t nitems, CxBuffer *buffer);
 
 /**
  * Appends data to a CxBuffer.
@@ -580,13 +527,8 @@
  * @see cxBufferRead()
  */
 cx_attr_nonnull
-cx_attr_export
-size_t cxBufferAppend(
-        const void *ptr,
-        size_t size,
-        size_t nitems,
-        CxBuffer *buffer
-);
+CX_EXPORT size_t cxBufferAppend(const void *ptr, size_t size,
+        size_t nitems, CxBuffer *buffer);
 
 /**
  * Performs a single flush-run on the specified buffer.
@@ -642,8 +584,7 @@
  * @see cxBufferEnableFlushing()
  */
 cx_attr_nonnull
-cx_attr_export
-size_t cxBufferFlush(CxBuffer *buffer);
+CX_EXPORT size_t cxBufferFlush(CxBuffer *buffer);
 
 /**
  * Reads data from a CxBuffer.
@@ -661,13 +602,8 @@
  * @see cxBufferAppend()
  */
 cx_attr_nonnull
-cx_attr_export
-size_t cxBufferRead(
-        void *ptr,
-        size_t size,
-        size_t nitems,
-        CxBuffer *buffer
-);
+CX_EXPORT size_t cxBufferRead(void *ptr, size_t size,
+        size_t nitems, CxBuffer *buffer);
 
 /**
  * Writes a character to a buffer.
@@ -689,11 +625,7 @@
  * @see cxBufferTerminate()
  */
 cx_attr_nonnull
-cx_attr_export
-int cxBufferPut(
-        CxBuffer *buffer,
-        int c
-);
+CX_EXPORT int cxBufferPut(CxBuffer *buffer, int c);
 
 /**
  * Writes a terminating zero to a buffer at the current position.
@@ -707,8 +639,7 @@
  * @return zero, if the terminator could be written, non-zero otherwise
  */
 cx_attr_nonnull
-cx_attr_export
-int cxBufferTerminate(CxBuffer *buffer);
+CX_EXPORT int cxBufferTerminate(CxBuffer *buffer);
 
 /**
  * Writes a string to a buffer.
@@ -719,13 +650,8 @@
  * @param str the zero-terminated string
  * @return the number of bytes written
  */
-cx_attr_nonnull
-cx_attr_cstr_arg(2)
-cx_attr_export
-size_t cxBufferPutString(
-        CxBuffer *buffer,
-        const char *str
-);
+cx_attr_nonnull cx_attr_cstr_arg(2)
+CX_EXPORT size_t cxBufferPutString(CxBuffer *buffer, const char *str);
 
 /**
  * Gets a character from a buffer.
@@ -736,8 +662,7 @@
  * @return the character or @c EOF, if the end of the buffer is reached
  */
 cx_attr_nonnull
-cx_attr_export
-int cxBufferGet(CxBuffer *buffer);
+CX_EXPORT int cxBufferGet(CxBuffer *buffer);
 
 #ifdef __cplusplus
 }

mercurial