docs/Writerside/topics/linked_list.h.md

changeset 1618
ef7cab6eb131
parent 1605
55b13f583356
--- a/docs/Writerside/topics/linked_list.h.md	Tue Dec 16 21:33:58 2025 +0100
+++ b/docs/Writerside/topics/linked_list.h.md	Wed Dec 17 19:05:50 2025 +0100
@@ -182,8 +182,13 @@
 
 void *cx_linked_list_find(const void *start,
         ptrdiff_t loc_advance, ptrdiff_t loc_data,
-        cx_compare_func cmp_func,
-        const void *elem, size_t *found_index);
+        const void *elem, size_t *found_index,
+        cx_compare_func cmp_func);
+        
+void *cx_linked_list_find_c(const void *start,
+        ptrdiff_t loc_advance, ptrdiff_t loc_data,
+        const void *elem, size_t *found_index,
+        cx_compare_func2 cmp_func, void *context);
 
 size_t cx_linked_list_size(const void *node, ptrdiff_t loc_next);
 ```
@@ -204,6 +209,8 @@
 If `loc_data` is zero, `elem` is expected to point to a node structure (which is usually artificially created for the sake of comparison and not contained in the list).
 When the searched element is found, a pointer to the node is returned and the index (assuming `start` has index zero) is written to the optional `found_index`, if non-`NULL`.
 
+The function `cx_linked_list_find_c()` allows additional `context` for the compare function.
+
 The size of a list, or sub-list, can be determined with `cx_linked_list_size()` which may start at an arbitrary `node“ in the list.
 
 > A creative way of using `cx_linked_list_size()` in doubly-linked lists is to use the offset of the `prev` pointer
@@ -251,6 +258,11 @@
 void cx_linked_list_sort(void **begin, void **end,
         ptrdiff_t loc_prev, ptrdiff_t loc_next,
         ptrdiff_t loc_data, cx_compare_func cmp_func);
+
+void cx_linked_list_sort_c(void **begin, void **end,
+        ptrdiff_t loc_prev, ptrdiff_t loc_next,
+        ptrdiff_t loc_data, cx_compare_func2 cmp_func,
+        void *context);
 ```
 
 The function `cx_linked_list_reverse()` swaps all links of all nodes in the specified list, effectively reversing the order of elements.
@@ -259,6 +271,8 @@
 The non-negative `loc_data` offset is used to calculate the pointers that are passed to the compare function.
 If you choose `loc_data` to be zero, the pointers to the nodes themselves are passed.
 
+The function `cx_linked_list_sort_c()` allows additional `context` for the compare function.
+
 > The `begin` pointer is required in all of the above functions while the `end` pointer is still optional.
 > {style="note"}
 
@@ -276,6 +290,12 @@
         ptrdiff_t loc_advance, ptrdiff_t loc_data,
         cx_compare_func cmp_func
 );
+
+int cx_linked_list_compare_c(
+        const void *begin_left, const void *begin_right,
+        ptrdiff_t loc_advance, ptrdiff_t loc_data,
+        cx_compare_func2 cmp_func, void *context
+);
 ```
 
 For comparing two linked list, you need to specify where to start,
@@ -288,6 +308,8 @@
 The `loc_data` offset is used to calculate the pointer that is passed to the `cmp_fnc`.
 This can either be the offset of a specific field in the struct or simply zero, in which case the pointers to the nodes themselves are passed to the compare function.
 
+The function `cx_linked_list_compare_c()` allows additional `context` for the compare function.
+
 <seealso>
 <category ref="apidoc">
 <a href="https://ucx.sourceforge.io/api/linked__list_8h.html">linked_list.h</a>

mercurial