*fixed a wrong list linkage bug with list sorting.
This commit is contained in:
parent
4a715f8ea8
commit
644bef1233
1
HISTORY
1
HISTORY
@ -1,5 +1,6 @@
|
|||||||
Feb. 18 2016
|
Feb. 18 2016
|
||||||
Added a generic iterator type
|
Added a generic iterator type
|
||||||
|
Fixed a wrong list linkage bug with list sorting
|
||||||
|
|
||||||
Feb. 16 2016
|
Feb. 16 2016
|
||||||
Fixed a bug of the EXIT statement with FOR loop
|
Fixed a bug of the EXIT statement with FOR loop
|
||||||
|
@ -2159,7 +2159,7 @@ static unsigned int _ls_foreach(_ls_node_t* list, _ls_operation op) {
|
|||||||
|
|
||||||
static _ls_node_t* _ls_sort(_ls_node_t** list, _ls_compare cmp) {
|
static _ls_node_t* _ls_sort(_ls_node_t** list, _ls_compare cmp) {
|
||||||
/* Copyright 2001 Simon Tatham, http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.c */
|
/* Copyright 2001 Simon Tatham, http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.c */
|
||||||
bool_t is_circular = false, is_double = false;
|
bool_t is_circular = false, is_double = true;
|
||||||
_ls_node_t* p, * q, * e, * tail, * oldhead;
|
_ls_node_t* p, * q, * e, * tail, * oldhead;
|
||||||
int insize, nmerges, psize, qsize, i;
|
int insize, nmerges, psize, qsize, i;
|
||||||
_ls_node_t* lst = 0;
|
_ls_node_t* lst = 0;
|
||||||
@ -2235,6 +2235,8 @@ static _ls_node_t* _ls_sort(_ls_node_t** list, _ls_compare cmp) {
|
|||||||
(*list)->next = lst;
|
(*list)->next = lst;
|
||||||
(*list)->prev = tail;
|
(*list)->prev = tail;
|
||||||
|
|
||||||
|
lst->prev = *list;
|
||||||
|
|
||||||
return *list;
|
return *list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user