[libgee] Add more missing generic type arguments
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgee] Add more missing generic type arguments
- Date: Fri, 15 Oct 2021 11:54:14 +0000 (UTC)
commit f0ccfe94ff731929e93601a38f931a12d52e5c2e
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Fri Oct 15 12:40:06 2021 +0200
Add more missing generic type arguments
gee/arrayqueue.vala | 2 +-
gee/concurrentset.vala | 4 ++--
gee/hashmap.vala | 10 +++++-----
gee/task.vala | 6 +++---
tests/testfunctions.vala | 26 +++++++++++++-------------
5 files changed, 24 insertions(+), 24 deletions(-)
---
diff --git a/gee/arrayqueue.vala b/gee/arrayqueue.vala
index d332af7..5dcfa60 100644
--- a/gee/arrayqueue.vala
+++ b/gee/arrayqueue.vala
@@ -364,7 +364,7 @@ public class Gee.ArrayQueue<G> : Gee.AbstractQueue<G>, Deque<G> {
}
}
- protected ArrayQueue _queue;
+ protected ArrayQueue<G> _queue;
protected int _stamp;
protected int _offset = -1;
protected bool _removed = false;
diff --git a/gee/concurrentset.vala b/gee/concurrentset.vala
index c5c7751..fe1741a 100644
--- a/gee/concurrentset.vala
+++ b/gee/concurrentset.vala
@@ -256,13 +256,13 @@ public class Gee.ConcurrentSet<G> : AbstractSortedSet<G> {
});
private class Iterator<G> : Object, Traversable<G>, Gee.Iterator<G> {
- public Iterator (ConcurrentSet cset, Tower<G> head) {
+ public Iterator (ConcurrentSet<G> cset, Tower<G> head) {
_curr = head;
_set = cset;
assert (_curr != null);
}
- public Iterator.point_at (ConcurrentSet cset, ref TowerIter<G> prev, Tower<G> curr) {
+ public Iterator.point_at (ConcurrentSet<G> cset, ref TowerIter<G> prev, Tower<G> curr) {
_curr = curr;
_set = cset;
_prev = prev;
diff --git a/gee/hashmap.vala b/gee/hashmap.vala
index b07d35e..a7bae9f 100644
--- a/gee/hashmap.vala
+++ b/gee/hashmap.vala
@@ -379,7 +379,7 @@ public class Gee.HashMap<K,V> : Gee.AbstractMap<K,V> {
private class KeySet<K,V> : AbstractSet<K> {
private HashMap<K,V> _map;
- public KeySet (HashMap map) {
+ public KeySet (HashMap<K,V> map) {
_map = map;
}
@@ -415,7 +415,7 @@ public class Gee.HashMap<K,V> : Gee.AbstractMap<K,V> {
private class ValueCollection<K,V> : AbstractCollection<V> {
private HashMap<K,V> _map;
- public ValueCollection (HashMap map) {
+ public ValueCollection (HashMap<K,V> map) {
_map = map;
}
@@ -491,7 +491,7 @@ public class Gee.HashMap<K,V> : Gee.AbstractMap<K,V> {
}
private abstract class NodeIterator<K,V> : Object {
- protected NodeIterator (HashMap map) {
+ protected NodeIterator (HashMap<K,V> map) {
_map = map;
_stamp = _map._stamp;
}
@@ -549,7 +549,7 @@ public class Gee.HashMap<K,V> : Gee.AbstractMap<K,V> {
}
private class KeyIterator<K,V> : NodeIterator<K,V>, Traversable<K>, Iterator<K> {
- public KeyIterator (HashMap map) {
+ public KeyIterator (HashMap<K,V> map) {
base (map);
}
@@ -607,7 +607,7 @@ public class Gee.HashMap<K,V> : Gee.AbstractMap<K,V> {
}
private class MapIterator<K,V> : NodeIterator<K,V>, Gee.MapIterator<K,V> {
- public MapIterator (HashMap map) {
+ public MapIterator (HashMap<K,V> map) {
base (map);
}
diff --git a/gee/task.vala b/gee/task.vala
index 00cf74f..155906d 100644
--- a/gee/task.vala
+++ b/gee/task.vala
@@ -69,8 +69,8 @@ namespace Gee {
public void run() {
promise.set_value(function());
}
- private static GLib.Once<ThreadPool<TaskData>> async_pool;
- internal static unowned ThreadPool<TaskData> get_async_pool () {
+ private static GLib.Once<ThreadPool<TaskData<G>>> async_pool;
+ internal static unowned ThreadPool<TaskData<G>> get_async_pool () {
return async_pool.once(() => {
int num_threads = (int)GLib.get_num_processors ();
string? gee_num_threads_str = Environment.get_variable("GEE_NUM_THREADS");
@@ -81,7 +81,7 @@ namespace Gee {
}
}
try {
- return new ThreadPool<TaskData>.with_owned_data((tdata) => {
+ return new ThreadPool<TaskData<G>>.with_owned_data((tdata) => {
tdata.run();
}, num_threads, false);
} catch (ThreadError err) {
diff --git a/tests/testfunctions.vala b/tests/testfunctions.vala
index 1fff514..7e963f3 100644
--- a/tests/testfunctions.vala
+++ b/tests/testfunctions.vala
@@ -36,9 +36,9 @@ public class FunctionsTests : Gee.TestCase {
string two = "two";
string two_copy = two.dup ();
- Gee.EqualDataFunc eq = Gee.Functions.get_equal_func_for (typeof (string));
- CompareDataFunc cmp = Gee.Functions.get_compare_func_for (typeof (string));
- Gee.HashDataFunc hash = Gee.Functions.get_hash_func_for (typeof (string));
+ Gee.EqualDataFunc<string> eq = Gee.Functions.get_equal_func_for (typeof (string));
+ CompareDataFunc<string> cmp = Gee.Functions.get_compare_func_for (typeof (string));
+ Gee.HashDataFunc<string> hash = Gee.Functions.get_hash_func_for (typeof (string));
assert (eq != null);
assert (cmp != null);
assert (hash != null);
@@ -59,12 +59,12 @@ public class FunctionsTests : Gee.TestCase {
}
public void test_int_func () {
- void *one = (void *)1;
- void *two = (void *)2;
+ int one = 1;
+ int two = 2;
- Gee.EqualDataFunc eq = Gee.Functions.get_equal_func_for (typeof (int));
- CompareDataFunc cmp = Gee.Functions.get_compare_func_for (typeof (int));
- Gee.HashDataFunc hash = Gee.Functions.get_hash_func_for (typeof (int));
+ Gee.EqualDataFunc<int> eq = Gee.Functions.get_equal_func_for (typeof (int));
+ CompareDataFunc<int> cmp = Gee.Functions.get_compare_func_for (typeof (int));
+ Gee.HashDataFunc<int> hash = Gee.Functions.get_hash_func_for (typeof (int));
assert (eq != null);
assert (cmp != null);
@@ -86,8 +86,8 @@ public class FunctionsTests : Gee.TestCase {
MyComparable one = new MyComparable(1);
MyComparable two_copy = new MyComparable(2);
- Gee.EqualDataFunc eq = Gee.Functions.get_equal_func_for (typeof (MyComparable));
- CompareDataFunc cmp = Gee.Functions.get_compare_func_for (typeof (MyComparable));
+ Gee.EqualDataFunc<MyComparable> eq = Gee.Functions.get_equal_func_for (typeof (MyComparable));
+ CompareDataFunc<MyComparable> cmp = Gee.Functions.get_compare_func_for (typeof
(MyComparable));
//Gee.HashDataFunc hash = Gee.Functions.get_hash_func_for (typeof (MyComparable));
assert (eq != null);
@@ -116,9 +116,9 @@ public class FunctionsTests : Gee.TestCase {
MyHashable minus_one = new MyHashable(-1);
MyHashable minus_one2 = new MyHashable(-1);
- Gee.EqualDataFunc eq = Gee.Functions.get_equal_func_for (typeof (MyHashable));
- CompareDataFunc cmp = Gee.Functions.get_compare_func_for (typeof (MyHashable));
- Gee.HashDataFunc hash = Gee.Functions.get_hash_func_for (typeof (MyHashable));
+ Gee.EqualDataFunc<MyHashable> eq = Gee.Functions.get_equal_func_for (typeof (MyHashable));
+ CompareDataFunc<MyHashable> cmp = Gee.Functions.get_compare_func_for (typeof (MyHashable));
+ Gee.HashDataFunc<MyHashable> hash = Gee.Functions.get_hash_func_for (typeof (MyHashable));
assert (eq != null);
assert (cmp != null);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]