]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Use default-value to pass element_size to GArray constructor f83ecd81d6ede886e1d2573c60da28b993db89e3
authorRico Tzschichholz <ricotz@ubuntu.com>
Sun, 10 Mar 2019 21:51:06 +0000 (22:51 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Fri, 22 Mar 2019 20:24:54 +0000 (21:24 +0100)
Based on patch by Jakub Kaszycki

codegen/valaccodebasemodule.vala
vapi/glib-2.0.vapi

index 0a46bd9adf3db528fd60d17df4171d9d6506b593..7b34ec7af8cfbd9f5464beaf056208e264520f04 100644 (file)
@@ -4874,13 +4874,6 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                                        carg_map = out_arg_map;
                                                }
 
-                                               // g_array_new: element size
-                                               if (cl == garray_type && param.name == "element_size") {
-                                                       var csizeof = new CCodeFunctionCall (new CCodeIdentifier ("sizeof"));
-                                                       csizeof.add_argument (new CCodeIdentifier (get_ccode_name (expr.type_reference.get_type_arguments ().get (0))));
-                                                       cexpr = csizeof;
-                                               }
-
                                                if (get_ccode_array_length (param) && param.variable_type is ArrayType) {
                                                        var array_type = (ArrayType) param.variable_type;
                                                        for (int dim = 1; dim <= array_type.rank; dim++) {
index 77f471057ce446d14615936972e6261d3255c883..15a62a1961807ec7d942f4f2e1d17ed3d195682f 100644 (file)
@@ -5289,9 +5289,9 @@ namespace GLib {
                [CCode (cname = "data", array_length_cname = "len", array_length_type = "uint")]
                public G[] data;
 
-               public Array (bool zero_terminated = true, bool clear = true, ulong element_size = 0);
+               public Array (bool zero_terminated = true, bool clear = true, ulong element_size = sizeof (G));
                [CCode (cname = "g_array_sized_new")]
-               public Array.sized (bool zero_terminated, bool clear, ulong element_size, uint reserved_size);
+               public Array.sized (bool zero_terminated = true, bool clear = true, ulong element_size = sizeof (G), uint reserved_size = 0);
                public void append_val (owned G value);
                public void append_vals (void* data, uint len);
                public void prepend_val (owned G value);