Fix list sort bug
This commit is contained in:
parent
27d3aa1c34
commit
dcdf32e2e4
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user