aboutsummaryrefslogtreecommitdiff
path: root/proc/vos_sort.c
diff options
context:
space:
mode:
authorM.Shulhan <ms@kilabit.org>2009-04-24 17:27:44 +0700
committerM.Shulhan <ms@kilabit.org>2009-04-24 17:27:44 +0700
commit168bef43351b3c2c57e177a0ef881c1dd0cfeaf3 (patch)
tree98f5096c8ceb1bf8ecbe5ff7e971eb63340f07f8 /proc/vos_sort.c
parent19c3ee85ea45c5b5c2a479af17b86ba65d52673b (diff)
downloadvos-168bef43351b3c2c57e177a0ef881c1dd0cfeaf3.tar.xz
stabilize sort output.
Diffstat (limited to 'proc/vos_sort.c')
-rw-r--r--proc/vos_sort.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/proc/vos_sort.c b/proc/vos_sort.c
index a013bc4..ce8fc28 100644
--- a/proc/vos_sort.c
+++ b/proc/vos_sort.c
@@ -67,16 +67,10 @@ static struct Record * sort(struct Record *rows, unsigned long n_row)
/* merge case 3 */
rows = 0;
s = record_cmp(l, r);
- if (s < 0) {
+ if (s <= 0) {
rows = l;
rows->row_last = rows;
l = l->row_next;
- } else if (s == 0) {
- rows = l;
- l = l->row_next;
- rows->row_next = r;
- rows->row_last = r;
- r = r->row_next;
} else {
rows = r;
rows->row_last = rows;
@@ -85,16 +79,10 @@ static struct Record * sort(struct Record *rows, unsigned long n_row)
while (l && r) {
s = record_cmp(l, r);
- if (s < 0) {
+ if (s <= 0) {
rows->row_last->row_next = l;
rows->row_last = l;
l = l->row_next;
- } else if (s == 0) {
- rows->row_last->row_next = l;
- l = l->row_next;
- rows->row_last->row_next->row_next = r;
- rows->row_last = r;
- r = r->row_next;
} else {
rows->row_last->row_next = r;
rows->row_last = r;