vala r1323 - in trunk: . gobject
- From: juergbi svn gnome org
- To: svn-commits-list gnome org
- Subject: vala r1323 - in trunk: . gobject
- Date: Sat, 26 Apr 2008 15:30:02 +0100 (BST)
Author: juergbi
Date: Sat Apr 26 14:30:01 2008
New Revision: 1323
URL: http://svn.gnome.org/viewvc/vala?rev=1323&view=rev
Log:
2008-04-26 Juerg Billeter <j bitron ch>
* gobject/valaccodegenerator.vala:
Always initialize local array length variables, fixes bug 529863
Modified:
trunk/ChangeLog
trunk/gobject/valaccodegenerator.vala
Modified: trunk/gobject/valaccodegenerator.vala
==============================================================================
--- trunk/gobject/valaccodegenerator.vala (original)
+++ trunk/gobject/valaccodegenerator.vala Sat Apr 26 14:30:01 2008
@@ -1180,8 +1180,23 @@
rhs = ccomma;
}
}
- } else if (local.variable_type.data_type != null && local.variable_type.data_type.is_reference_type ()) {
+ } else if (local.variable_type.is_reference_type_or_type_parameter ()) {
rhs = new CCodeConstant ("NULL");
+
+ if (local.variable_type is ArrayType) {
+ // initialize array length variables
+ var array_type = (ArrayType) local.variable_type;
+
+ var ccomma = new CCodeCommaExpression ();
+
+ for (int dim = 1; dim <= array_type.rank; dim++) {
+ ccomma.append_expression (new CCodeAssignment (new CCodeIdentifier (get_array_length_cname (local.name, dim)), new CCodeConstant ("0")));
+ }
+
+ ccomma.append_expression (rhs);
+
+ rhs = ccomma;
+ }
}
var cvar = new CCodeVariableDeclarator.with_initializer (get_variable_cname (local.name), rhs);
@@ -1196,7 +1211,7 @@
}
/* try to initialize uninitialized variables */
- if (local.initializer == null) {
+ if (cvar.initializer == null) {
cvar.initializer = default_value_for_type (local.variable_type, true);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]