core/clist: add clist_sort()#7655
Conversation
core/clist.c
Outdated
| * @{ | ||
| * | ||
| * @file | ||
| * @brief clist helper implentations |
core/clist.c
Outdated
| psize = 0; | ||
| for (i = 0; i < insize; i++) { | ||
| psize++; | ||
| q = (q->next == oldhead ? NULL : q->next); |
There was a problem hiding this comment.
I would place parentheses around the condition, i.e., (q->next == oldhead)
|
Please fix issues reported by Murdock, and also squash - pre-ACK. |
|
Sorry, I don't have time to review this at the moment. |
dc8bd9f to
258f7b7
Compare
done |
lol What is the motivation for this PR? |
Needed this for a pet project... Also I'm trying to fill the feature gap between clist & utlist. (#6209) |
I think all comments were addressed. @smlng you good? |
ping might have slipped through the release already... |
|
@smlng ping you've basically already ACK'ed this. :) |
|
ah sorry, for the delay ... |
|
&go. Thanks @smlng! |
This PR adds a function that sorts clists, using a stable merge-sort algorithm that runs in O(N log N) best-case and worst-case.
The actual sorting code is BSD-licensed (taken from https://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html).