]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Replace gvaluecollector_h_needed with dedidated add_include() calls
authorRico Tzschichholz <ricotz@ubuntu.com>
Wed, 27 Feb 2019 13:29:47 +0000 (14:29 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Wed, 27 Feb 2019 13:29:47 +0000 (14:29 +0100)
codegen/valaccodebasemodule.vala
codegen/valagtypemodule.vala

index 612ac79476fa7fc001b519c675e83d4d2ef5f131..b7d0de0100c19aca2c73b0ec6b70986744009573 100644 (file)
@@ -339,7 +339,6 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
        public bool in_plugin = false;
        public string module_init_param_name;
 
-       public bool gvaluecollector_h_needed;
        public bool requires_assert;
        public bool requires_array_free;
        public bool requires_array_move;
@@ -765,7 +764,6 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                next_regex_id = 0;
 
-               gvaluecollector_h_needed = false;
                requires_assert = false;
                requires_array_free = false;
                requires_array_move = false;
@@ -811,10 +809,6 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        append_vala_clear_mutex ("GCond", "g_cond");
                }
 
-               if (gvaluecollector_h_needed) {
-                       cfile.add_include ("gobject/gvaluecollector.h");
-               }
-
                var comments = source_file.get_comments();
                if (comments != null) {
                        foreach (Comment comment in comments) {
index 77838f792ad36cd0a4a58554d1f4081321ad364a..63ae8a153f4f8bf2d8b31500396f133e62820dc3 100644 (file)
@@ -689,9 +689,6 @@ public class Vala.GTypeModule : GErrorModule {
 
                                cfile.add_type_declaration (new CCodeTypeDefinition ("struct %s".printf (param_spec_struct.name), new CCodeVariableDeclarator ( "%sParamSpec%s".printf(get_ccode_prefix (cl.parent_symbol), cl.name))));
 
-
-                               gvaluecollector_h_needed = true;
-
                                add_type_value_table_init_function (cl);
                                add_type_value_table_free_function (cl);
                                add_type_value_table_copy_function (cl);
@@ -905,6 +902,9 @@ public class Vala.GTypeModule : GErrorModule {
        }
 
        private void add_type_value_table_lcopy_value_function ( Class cl ) {
+               // Required for GTypeCValue
+               cfile.add_include ("gobject/gvaluecollector.h");
+
                var function = new CCodeFunction ("%s_lcopy_value".printf (get_ccode_lower_case_name (cl, "value_")), "gchar*");
                function.add_parameter (new CCodeParameter ("value", "const GValue*"));
                function.add_parameter (new CCodeParameter ("n_collect_values", "guint"));
@@ -949,6 +949,9 @@ public class Vala.GTypeModule : GErrorModule {
        }
 
        private void add_type_value_table_collect_value_function (Class cl) {
+               // Required for GTypeCValue
+               cfile.add_include ("gobject/gvaluecollector.h");
+
                var function = new CCodeFunction ("%s_collect_value".printf (get_ccode_lower_case_name (cl, "value_")), "gchar*");
                function.add_parameter (new CCodeParameter ("value", "GValue*"));
                function.add_parameter (new CCodeParameter ("n_collect_values", "guint"));