Fix build with vala master
authorJürg Billeter <j@bitron.ch>
Sun, 21 Mar 2010 18:49:28 +0000 (19:49 +0100)
committerJürg Billeter <j@bitron.ch>
Sun, 21 Mar 2010 18:49:28 +0000 (19:49 +0100)
gee/functions.vala
gee/linkedlist.vala
gee/treeset.vala
tests/testreadonlycollection.vala
tests/testreadonlymap.vala

index 6c7a138..b7ee46b 100644 (file)
@@ -80,17 +80,13 @@ namespace Gee {
                        if (t == typeof (string)) {
                                return (CompareFunc) strcmp;
                        } else if (t.is_a (typeof (Comparable))) {
-                               return (CompareFunc) comparable_compare;
+                               return (CompareFunc) Comparable.compare_to;
                        } else {
                                return (CompareFunc) direct_compare;
                        }
                }
        }
 
-       internal static int comparable_compare (void* a, void* b) {
-               return ((Comparable) a).compare_to ((Comparable) b);
-       }
-
        /**
         * Compares two arbitrary elements together.
         *
index 68b7840..020ef77 100644 (file)
@@ -35,8 +35,8 @@
 public class Gee.LinkedList<G> : AbstractList<G>, Queue<G>, Deque<G> {
        private int _size = 0;
        private int _stamp = 0;
-       private Node? _head = null;
-       private Node? _tail = null;
+       private Node<G>? _head = null;
+       private Node<G>? _tail = null;
 
        /**
         * The elements' equality testing function.
index 53a7848..62ff8f3 100644 (file)
@@ -243,7 +243,7 @@ public class Gee.TreeSet<G> : AbstractSet<G>, SortedSet<G> {
                fix_up (ref node);
        }
 
-       private bool remove_from_node (ref Node<G>? node, G item, out weak Node<G>? prev = null, out weak Node<G>? next = null) {
+       private bool remove_from_node (ref Node<G>? node, G item, out unowned Node<G>? prev = null, out unowned Node<G>? next = null) {
 #if DEBUG
                stdout.printf ("Removing %s from %s\n", (string)item, node != null ? (string)node.key : null);
 #endif
@@ -375,7 +375,7 @@ public class Gee.TreeSet<G> : AbstractSet<G>, SortedSet<G> {
                return new SubSet<G> (this, after, before);
        }
 
-       private inline weak Node<G>? find_node (G item) {
+       private inline unowned Node<G>? find_node (G item) {
                weak Node<G>? cur = root;
                while (cur != null) {
                        int res = compare_func (item, cur.key);
@@ -398,7 +398,7 @@ public class Gee.TreeSet<G> : AbstractSet<G>, SortedSet<G> {
                return node != null ? new Iterator<G>.pointing (this, node) : null;
        }
 
-       private inline weak Node<G>? find_nearest (G item) {
+       private inline unowned Node<G>? find_nearest (G item) {
                weak Node<G>? cur = root;
                while (cur != null) {
                        int res = compare_func (item, cur.key);
@@ -417,28 +417,28 @@ public class Gee.TreeSet<G> : AbstractSet<G>, SortedSet<G> {
                return null;
        }
 
-       private inline weak Node<G>? find_lower (G item) {
+       private inline unowned Node<G>? find_lower (G item) {
                weak Node<G>? node = find_nearest (item);
                if (node == null)
                        return null;
                return compare_func (item, node.key) <= 0 ? node.prev : node;
        }
 
-       private inline weak Node<G>? find_higher (G item) {
+       private inline unowned Node<G>? find_higher (G item) {
                weak Node<G>? node = find_nearest (item);
                if (node == null)
                        return null;
                return compare_func (item, node.key) >= 0 ? node.next : node;
        }
 
-       private inline weak Node<G>? find_floor (G item) {
+       private inline unowned Node<G>? find_floor (G item) {
                weak Node<G>? node = find_nearest (item);
                if (node == null)
                        return null;
                return compare_func (item, node.key) < 0 ? node.prev : node;
        }
 
-       private inline weak Node<G>? find_ceil (G item) {
+       private inline unowned Node<G>? find_ceil (G item) {
                weak Node<G>? node = find_nearest (item);
                if (node == null)
                        return null;
@@ -803,7 +803,7 @@ public class Gee.TreeSet<G> : AbstractSet<G>, SortedSet<G> {
                        }
                }
 
-               public weak Node<G>? first () {
+               public unowned Node<G>? first () {
                        switch (type) {
                        case RangeType.EMPTY:
                                return null;
@@ -814,7 +814,7 @@ public class Gee.TreeSet<G> : AbstractSet<G>, SortedSet<G> {
                        }
                }
 
-               public weak Node<G>? last () {
+               public unowned Node<G>? last () {
                        switch (type) {
                        case RangeType.EMPTY:
                                return null;
index 6c09f86..7ee6417 100644 (file)
@@ -61,13 +61,13 @@ public class ReadOnlyCollectionTests : Gee.TestCase {
                assert (ro_collection == another_ro_collection);
 
                ro_collection.set_data ("marker", new Object ());
-               assert (another_ro_collection.get_data ("marker") != null);
+               assert (another_ro_collection.get_data<Object> ("marker") != null);
 
                another_ro_collection = null;
                ro_collection = null;
 
                another_ro_collection = get_ro_view (test_collection);
-               assert (another_ro_collection.get_data ("marker") == null);
+               assert (another_ro_collection.get_data<Object> ("marker") == null);
 
                // Check that the read-only view of the view is itself
                assert (another_ro_collection == get_ro_view (another_ro_collection));
index 217079e..e33b509 100644 (file)
@@ -52,13 +52,13 @@ public class ReadOnlyMapTests : Gee.TestCase {
                assert (ro_map == another_ro_map);
 
                ro_map.set_data ("marker", new Object ());
-               assert (another_ro_map.get_data ("marker") != null);
+               assert (another_ro_map.get_data<Object> ("marker") != null);
 
                another_ro_map = null;
                ro_map = null;
 
                another_ro_map = test_map.read_only_view;
-               assert (another_ro_map.get_data ("marker") == null);
+               assert (another_ro_map.get_data<Object> ("marker") == null);
 
                // Check that the read-only view of the view is itself
                assert (another_ro_map == another_ro_map.read_only_view);