]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
GDBus: Initialize array length variable in property get wrappers
authorJürg Billeter <j@bitron.ch>
Fri, 19 Oct 2012 21:46:17 +0000 (23:46 +0200)
committerJürg Billeter <j@bitron.ch>
Sun, 11 Nov 2012 13:01:15 +0000 (14:01 +0100)
This fixes a gcc warning when building with -O3.

Based on patch by Marc-Antoine Perennou.

Fixes bug 686123.

codegen/valagdbusservermodule.vala

index c92a44474f397ce1c321c049086bf396df304658..9da2bb8f115950155f4f820f38ed68dafc0b0b2b 100644 (file)
@@ -505,7 +505,7 @@ public class Vala.GDBusServerModule : GDBusClientModule {
                                for (int dim = 1; dim <= array_type.rank; dim++) {
                                        string length_cname = get_array_length_cname ("result", dim);
 
-                                       ccode.add_declaration ("int", new CCodeVariableDeclarator (length_cname));
+                                       ccode.add_declaration ("int", new CCodeVariableDeclarator.zero (length_cname, new CCodeConstant ("0")));
                                        ccall.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier (length_cname)));
                                }
                        }