diff -r 3ee5a5c7823a -r 313fd460d264 src/cx/linked_list.h --- a/src/cx/linked_list.h Sun Nov 30 15:06:02 2025 +0100 +++ b/src/cx/linked_list.h Sun Nov 30 15:41:15 2025 +0100 @@ -62,7 +62,14 @@ */ off_t loc_data; /** + * Location of extra data (optional). + * Negative when no extra data is requested. + * @see cx_linked_list_extra_data() + */ + off_t loc_extra; + /** * Additional bytes to allocate @em behind the payload (e.g. for metadata). + * @see cx_linked_list_extra_data() */ size_t extra_data_len; /** @@ -112,6 +119,23 @@ cxLinkedListCreate(NULL, NULL, elem_size) /** + * Instructs the linked list to reserve extra data in each node. + * + * The extra data will be aligned and placed behind the element data. + * The exact location in the node is stored in the @c loc_extra field + * of the linked list. + * + * You should usually not use this function except when you are creating an + * own linked-list implementation that is based on the UCX linked list and + * needs to store extra data in each node. + * + * @param list the list (must be a linked list) + * @param len the length of the extra data + */ +cx_attr_nonnull +CX_EXPORT void cx_linked_list_extra_data(cx_linked_list *list, size_t len); + +/** * Finds the node at a certain index. * * This function can be used to start at an arbitrary position within the list.