Fix: reversed sorting order
authorChristian Thaeter <ct@pipapo.org>
Mon, 18 Feb 2008 09:37:20 +0000 (10:37 +0100)
committerChristian Thaeter <ct@pipapo.org>
Mon, 18 Feb 2008 09:37:20 +0000 (10:37 +0100)
llist_sort sorted descending, should be ascending to conform with other
clib functions.

src/llist.h

index fc4cdf7..57a6486 100644 (file)
@@ -549,7 +549,7 @@ LLIST_FUNC (LList llist_sort (LList self, llist_cmpfn cmp),
                 llist_sort (&right, cmp);
 
                 while (!llist_is_empty (&left) && !llist_is_empty (&right))
-                  llist_insert_prev (self, cmp (left.next, right.next) > 0 ? left.next : right.next);
+                  llist_insert_prev (self, cmp (left.next, right.next) < 0 ? left.next : right.next);
 
                 if (!llist_is_empty (&left))
                   llist_insertlist_prev (self, &left);