Wed, 31 Dec 2025 16:18:48 +0100
fix online docs examples
--- a/docs/Writerside/topics/buffer.h.md Wed Dec 31 16:05:38 2025 +0100 +++ b/docs/Writerside/topics/buffer.h.md Wed Dec 31 16:18:48 2025 +0100 @@ -33,8 +33,8 @@ // initialize buffer and use stack memory for small requests char stackmem[128]; CxBuffer buf; - cxBufferInit(cxDefaultAllocator, - &buf, stackmem, sizeof(stackmem), + cxBufferInit(&buf, cxDefaultAllocator, + stackmem, sizeof(stackmem), CX_BUFFER_COPY_ON_EXTEND // move to heap when request is larger );
--- a/docs/Writerside/topics/mempool.h.md Wed Dec 31 16:05:38 2025 +0100 +++ b/docs/Writerside/topics/mempool.h.md Wed Dec 31 16:18:48 2025 +0100 @@ -164,15 +164,14 @@ cxMempoolRegister(pool, f, (cx_destructor_func) fclose); // create a buffer using the memory pool for destruction - CxBuffer *content = cxBufferCreate( - NULL, 256, pool->allocator, CX_BUFFER_AUTO_EXTEND + CxBuffer *content = cxBufferCreate(pool->allocator, + NULL, 256, CX_BUFFER_AUTO_EXTEND ); // read the file into the buffer and turn it into a string cx_stream_copy( f, content, (cx_read_func) fread, cxBufferWriteFunc ); - fclose(f); cxstring contentstr = cx_bstr(content); // split the string into lines @@ -185,7 +184,7 @@ // skip the header and parse the remaining data into a linked list // the nodes of the list shall also be allocated by the pool CxList* datalist = cxLinkedListCreate( - pool->allocator, NULL, sizeof(CSVData) + pool->allocator, sizeof(CSVData) ); for (size_t i = 1 ; i < lc ; i++) { if (lines[i].length == 0) continue;
--- a/docs/Writerside/topics/streams.h.md Wed Dec 31 16:05:38 2025 +0100 +++ b/docs/Writerside/topics/streams.h.md Wed Dec 31 16:18:48 2025 +0100 @@ -56,6 +56,12 @@ The following example shows how to read the contents of a file into a buffer: ```c +#include <cx/buffer.h> +#include <cx/utils.h> +#include <stdio.h> + +// ... + FILE *inputfile = fopen(infilename, "r"); if (inputfile) { CxBuffer fbuf;
--- a/docs/Writerside/topics/string.h.md Wed Dec 31 16:05:38 2025 +0100 +++ b/docs/Writerside/topics/string.h.md Wed Dec 31 16:18:48 2025 +0100 @@ -145,8 +145,11 @@ Example usage: ```C -cxmutstr str = cx_strcat(CX_NULLSTR, 2, - cx_str("Hello, "), cx_str("World!")); +cxmutstr str = cx_strcat( + CX_NULLSTR, 2, + cx_str("Hello, "), + cx_str("World!") +); ``` The function `cx_strlen()` sums the length of the specified strings.