Mercurial > hg > th-libs
diff th_datastruct.h @ 759:618c7fa3a4f8
Add th_llist_mergesort() for sorting linked lists.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 05 Feb 2023 02:16:22 +0200 |
parents | 2ab2fece83ea |
children | 6d3632306728 |
line wrap: on
line diff
--- a/th_datastruct.h Wed Feb 01 16:43:36 2023 +0200 +++ b/th_datastruct.h Sun Feb 05 02:16:22 2023 +0200 @@ -51,6 +51,10 @@ th_llist_t * th_llist_find_data(th_llist_t *list, const void *data); th_llist_t * th_llist_find_func(th_llist_t *list, const void *userdata, int (compare)(const void *, const void *)); +void th_llist_mergesort(th_llist_t **list, + int (compare)(const th_llist_t *lnode, const th_llist_t *rnode, void *userdata), + void *userdata); + /** @brief * Ringbuffer data structure