some fixes in example code

Fri, 07 Jul 2023 20:20:03 +0200

author
Mike Becker <universe@uap-core.de>
date
Fri, 07 Jul 2023 20:20:03 +0200
changeset 745
c99abca90d21
parent 744
937f8b5d4a3f
child 746
b4bd0155f03f

some fixes in example code

docs/src/features.md file | annotate | diff | comparison | revisions
     1.1 --- a/docs/src/features.md	Fri Jul 07 18:43:11 2023 +0200
     1.2 +++ b/docs/src/features.md	Fri Jul 07 20:20:03 2023 +0200
     1.3 @@ -46,11 +46,6 @@
     1.4      alloc.data = calloc(1, sizeof(struct my_allocator_state) + n);
     1.5      return alloc;
     1.6  }
     1.7 -
     1.8 -void free_my_allocator(CxAllocator *alloc) {
     1.9 -    free(alloc.data);
    1.10 -    free(alloc);
    1.11 -}
    1.12  ```
    1.13  
    1.14  ## String
    1.15 @@ -133,6 +128,7 @@
    1.16  
    1.17      // read the file into the buffer and turn it into a string
    1.18      cx_stream_copy(f, content, (cx_read_func) fread, (cx_write_func) cxBufferWrite);
    1.19 +    fclose(f);
    1.20      cxstring contentstr = cx_strn(content->space, content->size);
    1.21  
    1.22      // split the string into lines - use the mempool for allocating the target array
    1.23 @@ -235,7 +231,7 @@
    1.24      cx_list_class const *cl;    // The list class definition
    1.25  };
    1.26  ```
    1.27 -The actual structure contains one more class pointer that is used when wrapping a list into a pointer aware list
    1.28 +The actual structure contains one more class pointer that is used when wrapping a list into a pointer-aware list
    1.29  with `cxListStorePointers()`. What this means, is that - if you want to implement your own list structure - you
    1.30  only need to cover the case where the list is storing copies of your objects.
    1.31  

mercurial