Merge branch 'develop' into #3-issue

This commit is contained in:
Gregory Lirent 2022-06-10 21:19:41 +03:00
commit 902e1cb86c
2 changed files with 4 additions and 7 deletions

View File

@ -169,17 +169,14 @@ size_t list_slice(list_t* x, list_t* s, ssize_t i, size_t n, _Bool cut) {
} else {
if (c->prev) {
c->prev->next = e->next;
} else x->first = e->next;
} else s->first = e->next;
if (e->next) {
e->next->prev = c->prev;
} else s->last = c->prev;
e->next = nullptr;
c->prev = nullptr;
x->first = c;
x->last = e;
(x->first = c)->prev = nullptr;
(x->last = e)->next = nullptr;
}
return r;

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);
}