Fri, 07 Jul 2023 20:20:03 +0200
some fixes in example code
docs/src/features.md | file | annotate | diff | comparison | revisions |
--- a/docs/src/features.md Fri Jul 07 18:43:11 2023 +0200 +++ b/docs/src/features.md Fri Jul 07 20:20:03 2023 +0200 @@ -46,11 +46,6 @@ alloc.data = calloc(1, sizeof(struct my_allocator_state) + n); return alloc; } - -void free_my_allocator(CxAllocator *alloc) { - free(alloc.data); - free(alloc); -} ``` ## String @@ -133,6 +128,7 @@ // read the file into the buffer and turn it into a string cx_stream_copy(f, content, (cx_read_func) fread, (cx_write_func) cxBufferWrite); + fclose(f); cxstring contentstr = cx_strn(content->space, content->size); // split the string into lines - use the mempool for allocating the target array @@ -235,7 +231,7 @@ cx_list_class const *cl; // The list class definition }; ``` -The actual structure contains one more class pointer that is used when wrapping a list into a pointer aware list +The actual structure contains one more class pointer that is used when wrapping a list into a pointer-aware list with `cxListStorePointers()`. What this means, is that - if you want to implement your own list structure - you only need to cover the case where the list is storing copies of your objects.