Fix list sort bug

This commit is contained in:
Gregory Lirent 2022-06-10 16:29:54 +03:00
parent 27d3aa1c34
commit dcdf32e2e4

View File

@ -34,7 +34,7 @@ void list_sort(list_t* x) {
lnode_t *p = l->prev;
for (lnode_t* c = l; c != r; c = c->next) {
if (lnode_compare(c, r) < 0) {
if (lnode_compare(c, r) <= 0) {
p = (is_null(p)) ? l : p->next;
lnode_swap(p, c);
}