docs/Writerside/topics/list.h.md

changeset 1351
4407229bd944
parent 1344
8afaeb395b3c
--- a/docs/Writerside/topics/list.h.md	Tue Aug 26 21:55:19 2025 +0200
+++ b/docs/Writerside/topics/list.h.md	Wed Aug 27 23:07:39 2025 +0200
@@ -4,7 +4,7 @@
 
 UCX already comes with two common list implementations ([linked list](linked_list.h.md) and [array list](array_list.h.md))
 that should cover most use cases.
-But if you feel the need to implement an own list, you will find instructions [below](#implement-own-list-structures).
+But if you feel the need to implement your own list, you will find the instructions [below](#implement-own-list-structures).
 
 ```C
 #include <cx/linked_list.h>
@@ -32,7 +32,7 @@
 
 If `CX_STORE_POINTERS` is used as `elem_size`, the actual element size will be `sizeof(void*)` and the list will behave slightly differently when accessing elements.
 Lists that are storing pointers will always return the stored pointer directly, instead of returning a pointer into the list's memory, thus saving you from unnecessary dereferencing.
-Conversely, when adding elements to the list, the pointers you specify (e.g. in `cxListAdd()` or `cxListInsert()`) are directly added to the list, instead of copying the contents pointed to by the argument.
+Conversely, when adding elements to the list, the pointers you specify (e.g., in `cxListAdd()` or `cxListInsert()`) are directly added to the list, instead of copying the contents pointed to by the argument.
 
 > When you create a list which is storing pointers and do not specify a compare function, `cx_cmp_ptr` will be used by default.
 
@@ -100,7 +100,7 @@
 }
 ```
 
-Also, just registering `regfree()` as destructor is not sufficient anymore, because the `regex_t` structure also needs to be freed.
+Also, just registering `regfree()` as destructor is not enough anymore, because the `regex_t` structure also needs to be freed.
 Therefore, we would need to wrap the calls to `regfree()` and `free()` into an own destructor, which we then register with the list.
 However, it should be clear by now that using `CX_STORE_POINTERS` is a bad choice for this use case to begin with.
 
@@ -151,8 +151,8 @@
 If the list is storing pointers (cf. `cxCollectionStoresPointers()`), the pointer `elem` is directly added to the list.
 Otherwise, the contents at the location pointed to by `elem` are copied to the list's memory with the element size specified during creation of the list.
 
-On the other hand the `array` argument for `cxListAddArray()`, `cxListInsertArray()`, and `cxListInsertSortedArray()`
-must always point to an array of elements to be added (i.e. either an array of pointers, or an array of actual elements).
+On the other hand, the `array` argument for `cxListAddArray()`, `cxListInsertArray()`, and `cxListInsertSortedArray()`
+must always point to an array of elements to be added (i.e., either an array of pointers or an array of actual elements).
 
 A special requirement for `cxListInsertSortedArray()` is, that the `array` must already be sorted.
 
@@ -190,7 +190,7 @@
 
 The function `cxListAt()` accesses the element at the specified `index`.
 If the list is storing pointers (i.e. `cxCollectionStoresPointers()` returns `true`), the pointer at the specified index is directly returned.
-Otherwise, a pointer to element at the specified index is returned.
+Otherwise, a pointer to the element at the specified index is returned.
 If the index is out-of-bounds, the function returns `NULL`.
 The functions `cxListFirst()` and `cxListLast()` behave like `cxListAt()`,
 accessing the first or the last valid index, respectively, and returning `NULL` when the list is empty.
@@ -201,7 +201,7 @@
 If the list is storing pointers, the pointer value itself will be stored.
 The function returns `0` on success and `1` if the index is out of bounds.
 
-On the other hand, `cxListFind()` searches for the element pointed to by `elem` by comparing each element in the list with the list`s compare function,
+On the other hand, `cxListFind()` searches for the element pointed to by `elem` by comparing each element in the list with the list's compare function,
 and returns the first index when the element was found.
 Otherwise, the function returns the list size.
 
@@ -316,7 +316,7 @@
 
 > An invocation of `cxListSort` sets the `sorted` flag of the [collection](collection.h.md).
 > Implementations usually make use of this flag to optimize search operations, if possible.
-> For example the [array list](array_list.h.md) implementation will use binary search
+> For example, the [array list](array_list.h.md) implementation will use binary search
 > for `cxListFind()` and similar operations, when the list is sorted.
 
 ## Compare
@@ -329,10 +329,10 @@
 
 Arbitrary lists can be compared element-wise with `cxListCompare()`, as long as the compare functions of both lists are equivalent.
 
-That means, you can compare an UCX [array list](array_list.h.md) with a [linked list](linked_list.h.md),
+That means you can compare an UCX [array list](array_list.h.md) with a [linked list](linked_list.h.md),
 and you could even compare lists that are storing pointers with lists that are not storing pointers.
 
-However, the optimized list-internal compare implementation is only used, when both the compare functions and the list classes are identical.
+However, the optimized list-internal compare implementation is only used when both the compare functions and the list classes are identical.
 Otherwise, `cxListCompare()` will behave as if you were iterating through both lists and manually comparing the elements.
 
 The return value of `cxListCompare()` is zero, if the lists are element-wise equivalent.
@@ -351,7 +351,7 @@
 The effect is equivalent to invoking `cxListClear()` plus deallocating the memory for the list structure.
 That means, for each element in the list, the [destructor functions](collection.h.md#destructor-functions) are called before deallocating the list.
 
-When the list has been storing pointers, make sure that either another reference to the same memory exist in your program,
+When the list has been storing pointers, make sure that either another reference to the same memory exists in your program,
 or any of the destructor functions deallocates the memory.
 Otherwise, there is a risk of a memory leak.
 
@@ -359,7 +359,7 @@
 
 If you want to create your own list implementation, this is extremely easy.
 
-You just need to define a function for creating your list and assign a `cx_list_class` structure with the pointers to your implementation.
+You need to define a function for creating your list and assign a `cx_list_class` structure with the pointers to your implementation.
 Then you call the `cx_list_init()` helper function to initialize the collection sture.
 This also automatically adds support for `CX_STORE_POINTERS` to your list. 
 
@@ -430,7 +430,7 @@
 > If you initialize your list with `cx_list_init()` you do not have to worry about making a
 > difference between storing pointers and storing elements, because your implementation will
 > be automatically wrapped.
-> This means, you only have to handle the one single case described above.
+> This means you only have to handle the one single case described above.
 
 ### Default Class Function Implementations
 

mercurial