# HG changeset patch # User Mike Becker # Date 1680541771 -7200 # Node ID 60fb6aec157dd01bb0074c8bb6cfa141aa93f5d0 # Parent 55d8fdd38ca4c01bde93ab196ca94cc7ed2bc8d1 make allocator in cxBufferInit optional diff -r 55d8fdd38ca4 -r 60fb6aec157d src/buffer.c --- a/src/buffer.c Sat Apr 01 11:51:48 2023 +0200 +++ b/src/buffer.c Mon Apr 03 19:09:31 2023 +0200 @@ -39,6 +39,7 @@ CxAllocator const *allocator, int flags ) { + if (allocator == NULL) allocator = cxDefaultAllocator; buffer->allocator = allocator; buffer->flags = flags; if (!space) { diff -r 55d8fdd38ca4 -r 60fb6aec157d src/cx/buffer.h --- a/src/cx/buffer.h Sat Apr 01 11:51:48 2023 +0200 +++ b/src/cx/buffer.h Mon Apr 03 19:09:31 2023 +0200 @@ -149,11 +149,12 @@ * @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 + * @param allocator the allocator this buffer shall use for automatic + * memory management. If \c NULL, the default heap allocator will be used. * @param flags buffer features (see cx_buffer_s.flags) * @return zero on success, non-zero if a required allocation failed */ -__attribute__((__nonnull__(1, 4))) +__attribute__((__nonnull__(1))) int cxBufferInit( CxBuffer *buffer, void *space,