[vala/staging] Add missing generic-type arguments
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] Add missing generic-type arguments
- Date: Sat, 8 Oct 2016 13:02:46 +0000 (UTC)
commit 6e612a3e2f1cb58ad6c5aff5b9bfe7edd2f914a5
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sat Oct 8 14:44:22 2016 +0200
Add missing generic-type arguments
codegen/valagirwriter.vala | 2 +-
gee/arraylist.vala | 6 +++---
gee/hashmap.vala | 14 +++++++-------
gee/hashset.vala | 10 +++++-----
vala/valacodewriter.vala | 4 ++--
vala/valagirparser.vala | 7 ++-----
vapigen/valagidlparser.vala | 2 +-
7 files changed, 21 insertions(+), 24 deletions(-)
---
diff --git a/codegen/valagirwriter.vala b/codegen/valagirwriter.vala
index 01389cf..3f4d15d 100644
--- a/codegen/valagirwriter.vala
+++ b/codegen/valagirwriter.vala
@@ -123,7 +123,7 @@ public class Vala.GIRWriter : CodeVisitor {
}
}
- private ArrayList<GIRNamespace?> externals = new ArrayList<GIRNamespace?> ((EqualFunc)
GIRNamespace.equal);
+ private ArrayList<GIRNamespace?> externals = new ArrayList<GIRNamespace?> ((EqualFunc<GIRNamespace>)
GIRNamespace.equal);
public void write_includes() {
foreach (var i in externals) {
diff --git a/gee/arraylist.vala b/gee/arraylist.vala
index 5d2b392..fe398e4 100644
--- a/gee/arraylist.vala
+++ b/gee/arraylist.vala
@@ -32,18 +32,18 @@ public class Vala.ArrayList<G> : List<G> {
get { return _size; }
}
- public EqualFunc equal_func {
+ public EqualFunc<G> equal_func {
set { _equal_func = value; }
}
private G[] _items = new G[4];
private int _size;
- private EqualFunc _equal_func;
+ private EqualFunc<G> _equal_func;
// concurrent modification protection
private int _stamp = 0;
- public ArrayList (EqualFunc equal_func = GLib.direct_equal) {
+ public ArrayList (EqualFunc<G> equal_func = GLib.direct_equal) {
this.equal_func = equal_func;
}
diff --git a/gee/hashmap.vala b/gee/hashmap.vala
index 33c2ef9..9085f10 100644
--- a/gee/hashmap.vala
+++ b/gee/hashmap.vala
@@ -32,15 +32,15 @@ public class Vala.HashMap<K,V> : Map<K,V> {
get { return _nnodes; }
}
- public HashFunc key_hash_func {
+ public HashFunc<K> key_hash_func {
set { _key_hash_func = value; }
}
- public EqualFunc key_equal_func {
+ public EqualFunc<K> key_equal_func {
set { _key_equal_func = value; }
}
- public EqualFunc value_equal_func {
+ public EqualFunc<V> value_equal_func {
set { _value_equal_func = value; }
}
@@ -51,14 +51,14 @@ public class Vala.HashMap<K,V> : Map<K,V> {
// concurrent modification protection
private int _stamp = 0;
- private HashFunc _key_hash_func;
- private EqualFunc _key_equal_func;
- private EqualFunc _value_equal_func;
+ private HashFunc<K> _key_hash_func;
+ private EqualFunc<K> _key_equal_func;
+ private EqualFunc<V> _value_equal_func;
private const int MIN_SIZE = 11;
private const int MAX_SIZE = 13845163;
- public HashMap (HashFunc key_hash_func = GLib.direct_hash, EqualFunc key_equal_func =
GLib.direct_equal, EqualFunc value_equal_func = GLib.direct_equal) {
+ public HashMap (HashFunc<K> key_hash_func = GLib.direct_hash, EqualFunc<K> key_equal_func =
GLib.direct_equal, EqualFunc<V> value_equal_func = GLib.direct_equal) {
this.key_hash_func = key_hash_func;
this.key_equal_func = key_equal_func;
this.value_equal_func = value_equal_func;
diff --git a/gee/hashset.vala b/gee/hashset.vala
index 01452c6..6ca0dfa 100644
--- a/gee/hashset.vala
+++ b/gee/hashset.vala
@@ -32,11 +32,11 @@ public class Vala.HashSet<G> : Set<G> {
get { return _nnodes; }
}
- public HashFunc hash_func {
+ public HashFunc<G> hash_func {
set { _hash_func = value; }
}
- public EqualFunc equal_func {
+ public EqualFunc<G> equal_func {
set { _equal_func = value; }
}
@@ -47,13 +47,13 @@ public class Vala.HashSet<G> : Set<G> {
// concurrent modification protection
private int _stamp = 0;
- private HashFunc _hash_func;
- private EqualFunc _equal_func;
+ private HashFunc<G> _hash_func;
+ private EqualFunc<G> _equal_func;
private const int MIN_SIZE = 11;
private const int MAX_SIZE = 13845163;
- public HashSet (HashFunc hash_func = GLib.direct_hash, EqualFunc equal_func = GLib.direct_equal) {
+ public HashSet (HashFunc<G> hash_func = GLib.direct_hash, EqualFunc<G> equal_func =
GLib.direct_equal) {
this.hash_func = hash_func;
this.equal_func = equal_func;
_array_size = MIN_SIZE;
diff --git a/vala/valacodewriter.vala b/vala/valacodewriter.vala
index ec48ed0..1d83a20 100644
--- a/vala/valacodewriter.vala
+++ b/vala/valacodewriter.vala
@@ -1651,10 +1651,10 @@ public class Vala.CodeWriter : CodeVisitor {
if (key == "cheader_filename" && sym is Namespace) {
continue;
}
- keys.insert_sorted (key, (CompareDataFunc) strcmp);
+ keys.insert_sorted (key, (CompareDataFunc<string>) strcmp);
}
if (need_cheaders && attr.name == "CCode" && !attr.has_argument ("cheader_filename"))
{
- keys.insert_sorted ("cheader_filename", (CompareDataFunc) strcmp);
+ keys.insert_sorted ("cheader_filename", (CompareDataFunc<string>) strcmp);
}
if (attr.name == "CCode" && keys.get_length () == 0) {
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index b453069..b5c99f3 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -3949,8 +3949,7 @@ public class Vala.GirParser : CodeVisitor {
/* Hash and equal functions */
- static uint unresolved_symbol_hash (void *ptr) {
- var sym = (UnresolvedSymbol) ptr;
+ static uint unresolved_symbol_hash (UnresolvedSymbol sym) {
var builder = new StringBuilder ();
while (sym != null) {
builder.append (sym.name);
@@ -3959,9 +3958,7 @@ public class Vala.GirParser : CodeVisitor {
return builder.str.hash ();
}
- static bool unresolved_symbol_equal (void *ptr1, void *ptr2) {
- var sym1 = (UnresolvedSymbol) ptr1;
- var sym2 = (UnresolvedSymbol) ptr2;
+ static bool unresolved_symbol_equal (UnresolvedSymbol sym1, UnresolvedSymbol sym2) {
while (sym1 != sym2) {
if (sym1 == null || sym2 == null) {
return false;
diff --git a/vapigen/valagidlparser.vala b/vapigen/valagidlparser.vala
index 543b686..731ea26 100644
--- a/vapigen/valagidlparser.vala
+++ b/vapigen/valagidlparser.vala
@@ -105,7 +105,7 @@ public class Vala.GIdlParser : CodeVisitor {
current_source_file = source_file;
codenode_attributes_map = new HashMap<string,string> (str_hash, str_equal);
- codenode_attributes_patterns = new HashMap<PatternSpec*,string> (direct_hash, (EqualFunc)
PatternSpec.equal);
+ codenode_attributes_patterns = new HashMap<PatternSpec*,string> (direct_hash,
(EqualFunc<PatternSpec>) PatternSpec.equal);
if (FileUtils.test (metadata_filename, FileTest.EXISTS)) {
try {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]