Mon, 03 Apr 2023 19:09:31 +0200
make allocator in cxBufferInit optional
src/buffer.c | file | annotate | diff | comparison | revisions | |
src/cx/buffer.h | file | annotate | diff | comparison | revisions |
--- 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) {
--- 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,