+2007-07-22 Jürg Billeter <j@bitron.ch>
+
+ * vala/valadatatype.vala: use lazy initialization for array_types
+ hash table
+
2007-07-22 Jürg Billeter <j@bitron.ch>
* vala/valainterface.vala, vala/valainterfacewriter.vala: support
private Pointer pointer_type;
/* holds the array types of this type; each rank is a separate one */
- /* FIXME: uses string because int does not work as key yet */
- private HashTable<string,Array> array_types = new HashTable.full (str_hash, str_equal, g_free, g_object_unref);
+ private HashTable<int,Array> array_types;
/**
* Returns the name of this data type as it is used in C code.
* @return array type for this data type
*/
public Array! get_array (int rank) {
- Array array_type = (Array) array_types.lookup (rank.to_string ());
-
+ Array array_type = null;
+
+ if (array_types != null) {
+ array_type = array_types.lookup (rank);
+ }
+
if (array_type == null) {
+ if (array_types == null) {
+ array_types = new HashTable.full (direct_hash, direct_equal, null, g_object_unref);
+ }
+
var new_array_type = new Array (this, rank, source_reference);
parent_symbol.scope.add (new_array_type.name, new_array_type);
/* link the array type to the same source as the container type */
new_array_type.source_reference = this.source_reference;
- array_types.insert (rank.to_string (), new_array_type);
+ array_types.insert (rank, new_array_type);
array_type = new_array_type;
}