--- a/src/cx/buffer.h Sun Dec 14 14:29:27 2025 +0100 +++ b/src/cx/buffer.h Sun Dec 14 15:41:02 2025 +0100 @@ -168,18 +168,18 @@ * space will be leaking after the copy-on-write operation. * * @param buffer the buffer to initialize + * @param allocator the allocator this buffer shall use for automatic + * memory management + * (if @c NULL, the cxDefaultAllocator will be used) * @param space pointer to the memory area, or @c NULL to allocate * new memory * @param capacity the capacity of the buffer - * @param allocator the allocator this buffer shall use for automatic - * memory management - * (if @c NULL, the cxDefaultAllocator will be used) * @param flags buffer features (see cx_buffer_s.flags) * @return zero on success, non-zero if a required allocation failed */ cx_attr_nonnull_arg(1) -CX_EXPORT int cxBufferInit(CxBuffer *buffer, void *space, size_t capacity, - const CxAllocator *allocator, int flags); +CX_EXPORT int cxBufferInit(CxBuffer *buffer, const CxAllocator *allocator, + void *space, size_t capacity, int flags); /** * Destroys the buffer contents. @@ -219,18 +219,18 @@ * Then this function will allocate the space and enforce * the #CX_BUFFER_FREE_CONTENTS flag. * + * @param allocator the allocator to use for allocating the structure and the automatic + * memory management within the buffer + * (if @c NULL, the cxDefaultAllocator will be used) * @param space pointer to the memory area, or @c NULL to allocate * new memory * @param capacity the capacity of the buffer - * @param allocator the allocator to use for allocating the structure and the automatic - * memory management within the buffer - * (if @c NULL, the cxDefaultAllocator will be used) * @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_EXPORT CxBuffer *cxBufferCreate(void *space, size_t capacity, - const CxAllocator *allocator, int flags); +CX_EXPORT CxBuffer *cxBufferCreate(const CxAllocator *allocator, void *space, + size_t capacity, int flags); /** * Shifts the contents of the buffer by the given offset.