[vala/staging] codegen: Replace gvaluecollector_h_needed with dedidated add_include() calls



commit af6959c44d166e66f4adf044e9eb2a70bab90202
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Wed Feb 27 14:29:47 2019 +0100

    codegen: Replace gvaluecollector_h_needed with dedidated add_include() calls

 codegen/valaccodebasemodule.vala | 6 ------
 codegen/valagtypemodule.vala     | 9 ++++++---
 2 files changed, 6 insertions(+), 9 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 612ac7947..b7d0de010 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -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) {
diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala
index 77838f792..63ae8a153 100644
--- a/codegen/valagtypemodule.vala
+++ b/codegen/valagtypemodule.vala
@@ -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"));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]