]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: More use of get_ccode_type_name()
authorRico Tzschichholz <ricotz@ubuntu.com>
Wed, 3 Mar 2021 09:05:00 +0000 (10:05 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sat, 13 Mar 2021 20:21:17 +0000 (21:21 +0100)
codegen/valaccodeattribute.vala
codegen/valaccodebasemodule.vala
codegen/valaccodemethodmodule.vala
codegen/valagtypemodule.vala
codegen/valatyperegisterfunction.vala

index 82c30b7f2efea8bf16920eb762128dd7cc1a2df4..dfa03531c350e4169d01ee988bb654898b8a3436 100644 (file)
@@ -842,7 +842,7 @@ public class Vala.CCodeAttribute : AttributeCache {
                        return "void";
                } else if (node is ClassType) {
                        var type = (ClassType) node;
-                       return "%sClass*".printf (get_ccode_name (type.class_symbol));
+                       return "%s*".printf (get_ccode_type_name (type.class_symbol));
                } else if (node is InterfaceType) {
                        var type = (InterfaceType) node;
                        return "%s*".printf (get_ccode_type_name (type.interface_symbol));
index c2cecb2b07038551a1717dcf88ad38267ca2a4e0..15ae9e4fcab65cc3829dbac3e72568976d76e2fe 100644 (file)
@@ -1781,7 +1781,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                        vcast = new CCodeIdentifier ("_klass_");
                                        var vcastcall = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_type_get_function (cl)));
                                        ((CCodeFunctionCall) vcastcall).add_argument (new CCodeIdentifier ("self"));
-                                       ccode.add_declaration ("%sClass*".printf (get_ccode_name (cl)), new CCodeVariableDeclarator ("_klass_"));
+                                       ccode.add_declaration ("%s*".printf (get_ccode_type_name (cl)), new CCodeVariableDeclarator ("_klass_"));
                                        ccode.add_assignment (vcast, vcastcall);
                                } else {
                                        vcast = new CCodeIdentifier ("self");
index 9777a5013b7af891bfb817269981f0553f31c1ef..979eead1ab05b88eb9d216f3269b0b083eb2009e 100644 (file)
@@ -1140,7 +1140,7 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
                        if (!cl.is_compact) {
                                var vcastcall = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_type_get_function (cl)));
                                ((CCodeFunctionCall) vcastcall).add_argument (new CCodeIdentifier ("self"));
-                               ccode.add_declaration ("%sClass*".printf (get_ccode_name (cl)), new CCodeVariableDeclarator ("_klass_"));
+                               ccode.add_declaration ("%s*".printf (get_ccode_type_name (cl)), new CCodeVariableDeclarator ("_klass_"));
                                ccode.add_assignment (vcast, vcastcall);
                        }
                }
index d6efb57aaf635e005e5e8a6387a9f943d0f1b8af..699aca8df2d3c2982b5e42029e58f01a872327e8 100644 (file)
@@ -75,7 +75,7 @@ public class Vala.GTypeModule : GErrorModule {
                        macro = "(G_TYPE_CHECK_INSTANCE_CAST ((obj), %s, %s))".printf (get_ccode_type_id (cl), get_ccode_name (cl));
                        decl_space.add_type_declaration (new CCodeMacroReplacement ("%s(obj)".printf (get_ccode_type_cast_function (cl)), macro));
 
-                       macro = "(G_TYPE_CHECK_CLASS_CAST ((klass), %s, %sClass))".printf (get_ccode_type_id (cl), get_ccode_name (cl));
+                       macro = "(G_TYPE_CHECK_CLASS_CAST ((klass), %s, %s))".printf (get_ccode_type_id (cl), get_ccode_type_name (cl));
                        decl_space.add_type_declaration (new CCodeMacroReplacement ("%s(klass)".printf (get_ccode_class_type_function (cl)), macro));
 
                        macro = "(G_TYPE_CHECK_INSTANCE_TYPE ((obj), %s))".printf (get_ccode_type_id (cl));
@@ -84,7 +84,7 @@ public class Vala.GTypeModule : GErrorModule {
                        macro = "(G_TYPE_CHECK_CLASS_TYPE ((klass), %s))".printf (get_ccode_type_id (cl));
                        decl_space.add_type_declaration (new CCodeMacroReplacement ("%s(klass)".printf (get_ccode_class_type_check_function (cl)), macro));
 
-                       macro = "(G_TYPE_INSTANCE_GET_CLASS ((obj), %s, %sClass))".printf (get_ccode_type_id (cl), get_ccode_name (cl));
+                       macro = "(G_TYPE_INSTANCE_GET_CLASS ((obj), %s, %s))".printf (get_ccode_type_id (cl), get_ccode_type_name (cl));
                        decl_space.add_type_declaration (new CCodeMacroReplacement ("%s(obj)".printf (get_ccode_type_get_function (cl)), macro));
                        decl_space.add_type_declaration (new CCodeNewline ());
                }
@@ -483,7 +483,7 @@ public class Vala.GTypeModule : GErrorModule {
                bool has_class_locks = false;
 
                var instance_priv_struct = new CCodeStruct ("_%sPrivate".printf (get_ccode_name (cl)));
-               var type_priv_struct = new CCodeStruct ("_%sClassPrivate".printf (get_ccode_name (cl)));
+               var type_priv_struct = new CCodeStruct ("_%sPrivate".printf (get_ccode_type_name (cl)));
 
                if (is_gtypeinstance) {
                        /* create type, dup_func, and destroy_func fields for generic types */
@@ -537,7 +537,7 @@ public class Vala.GTypeModule : GErrorModule {
 
                if (is_gtypeinstance) {
                        if (cl.has_class_private_fields || has_class_locks) {
-                               decl_space.add_type_declaration (new CCodeTypeDefinition ("struct %s".printf (type_priv_struct.name), new CCodeVariableDeclarator ("%sClassPrivate".printf (get_ccode_name (cl)))));
+                               decl_space.add_type_declaration (new CCodeTypeDefinition ("struct %s".printf (type_priv_struct.name), new CCodeVariableDeclarator ("%sPrivate".printf (get_ccode_type_name (cl)))));
                        }
 
                        /* only add the *Private struct if it is not empty, i.e. we actually have private data */
@@ -569,7 +569,7 @@ public class Vala.GTypeModule : GErrorModule {
                        if (cl.has_class_private_fields || has_class_locks) {
                                decl_space.add_type_definition (type_priv_struct);
 
-                               string macro = "(G_TYPE_CLASS_GET_PRIVATE (klass, %s, %sClassPrivate))".printf (get_ccode_type_id (cl), get_ccode_name (cl));
+                               string macro = "(G_TYPE_CLASS_GET_PRIVATE (klass, %s, %sPrivate))".printf (get_ccode_type_id (cl), get_ccode_type_name (cl));
                                decl_space.add_type_member_declaration (new CCodeMacroReplacement ("%s(klass)".printf (get_ccode_class_get_private_function (cl)), macro));
                        }
                }
@@ -1199,7 +1199,7 @@ public class Vala.GTypeModule : GErrorModule {
                push_context (base_init_context);
 
                var base_init = new CCodeFunction ("%s_base_init".printf (get_ccode_lower_case_name (cl, null)), "void");
-               base_init.add_parameter (new CCodeParameter ("klass", "%sClass *".printf (get_ccode_name (cl))));
+               base_init.add_parameter (new CCodeParameter ("klass", "%s *".printf (get_ccode_type_name (cl))));
                base_init.modifiers = CCodeModifiers.STATIC;
 
                push_function (base_init);
@@ -1221,7 +1221,7 @@ public class Vala.GTypeModule : GErrorModule {
                push_context (class_init_context);
 
                var func = new CCodeFunction ("%s_class_init".printf (get_ccode_lower_case_name (cl, null)));
-               func.add_parameter (new CCodeParameter ("klass", "%sClass *".printf (get_ccode_name (cl))));
+               func.add_parameter (new CCodeParameter ("klass", "%s *".printf (get_ccode_type_name (cl))));
                func.add_parameter (new CCodeParameter ("klass_data", "gpointer"));
                func.modifiers = CCodeModifiers.STATIC;
 
@@ -1250,7 +1250,7 @@ public class Vala.GTypeModule : GErrorModule {
                                fundamental_class = fundamental_class.base_class;
                        }
 
-                       var ccast = new CCodeCastExpression (new CCodeIdentifier ("klass"), "%sClass *".printf (get_ccode_name (fundamental_class)));
+                       var ccast = new CCodeCastExpression (new CCodeIdentifier ("klass"), "%s *".printf (get_ccode_type_name (fundamental_class)));
                        var finalize_assignment = new CCodeAssignment (new CCodeMemberAccess.pointer (ccast, "finalize"), new CCodeIdentifier ("%sfinalize".printf (get_ccode_lower_case_prefix (cl))));
                        ccode.add_expression (finalize_assignment);
                }
@@ -1276,7 +1276,7 @@ public class Vala.GTypeModule : GErrorModule {
 
                                CCodeExpression cfunc = new CCodeIdentifier (get_ccode_real_name (m));
                                cfunc = cast_method_pointer (m.base_method, cfunc, base_type, (m.coroutine ? 1 : 3));
-                               var ccast = new CCodeCastExpression (new CCodeIdentifier ("klass"), "%sClass *".printf (get_ccode_name (base_type)));
+                               var ccast = new CCodeCastExpression (new CCodeIdentifier ("klass"), "%s *".printf (get_ccode_type_name (base_type)));
                                ccode.add_assignment (new CCodeMemberAccess.pointer (ccast, get_ccode_vfunc_name (m.base_method)), cfunc);
 
                                if (m.coroutine) {
@@ -1293,7 +1293,7 @@ public class Vala.GTypeModule : GErrorModule {
                                continue;
                        }
 
-                       var ccast = new CCodeCastExpression (new CCodeIdentifier ("klass"), "%sClass *".printf (get_ccode_name (cl)));
+                       var ccast = new CCodeCastExpression (new CCodeIdentifier ("klass"), "%s *".printf (get_ccode_type_name (cl)));
                        ccode.add_assignment (new CCodeMemberAccess.pointer (ccast, get_ccode_vfunc_name (sig.default_handler)), new CCodeIdentifier (get_ccode_real_name (sig.default_handler)));
                }
 
@@ -1700,7 +1700,7 @@ public class Vala.GTypeModule : GErrorModule {
                var function = new CCodeFunction ("%s_class_finalize".printf (get_ccode_lower_case_name (cl, null)), "void");
                function.modifiers = CCodeModifiers.STATIC;
 
-               function.add_parameter (new CCodeParameter ("klass", "%sClass *".printf (get_ccode_name (cl))));
+               function.add_parameter (new CCodeParameter ("klass", "%s *".printf (get_ccode_type_name (cl))));
 
                push_function (function);
 
@@ -1722,7 +1722,7 @@ public class Vala.GTypeModule : GErrorModule {
                var function = new CCodeFunction ("%s_base_finalize".printf (get_ccode_lower_case_name (cl, null)), "void");
                function.modifiers = CCodeModifiers.STATIC;
 
-               function.add_parameter (new CCodeParameter ("klass", "%sClass *".printf (get_ccode_name (cl))));
+               function.add_parameter (new CCodeParameter ("klass", "%s *".printf (get_ccode_type_name (cl))));
                function.add_parameter (new CCodeParameter ("klass_data", "gpointer"));
 
                push_function (function);
@@ -2201,7 +2201,7 @@ public class Vala.GTypeModule : GErrorModule {
                push_context (new EmitContext (iface));
 
                var default_init = new CCodeFunction ("%s_default_init".printf (get_ccode_lower_case_name (iface, null)), "void");
-               default_init.add_parameter (new CCodeParameter ("iface", "%sIface *".printf (get_ccode_name (iface))));
+               default_init.add_parameter (new CCodeParameter ("iface", "%s *".printf (get_ccode_type_name (iface))));
                default_init.add_parameter (new CCodeParameter ("iface_data", "gpointer"));
                default_init.modifiers = CCodeModifiers.STATIC;
 
index eac326312e32fa2cb5090f4467d46d1f8acfb562..2150df0d7981cea93ccef1d2cb857373d51a474a 100644 (file)
@@ -223,7 +223,7 @@ public abstract class Vala.TypeRegisterFunction {
 
                        add_class_private_call = new CCodeFunctionCall (new CCodeIdentifier ("g_type_add_class_private"));
                        add_class_private_call.add_argument (new CCodeIdentifier (type_id_name));
-                       add_class_private_call.add_argument (new CCodeIdentifier ("sizeof (%sClassPrivate)".printf (get_ccode_name (type_symbol))));
+                       add_class_private_call.add_argument (new CCodeIdentifier ("sizeof (%sPrivate)".printf (get_ccode_type_name (cl))));
                        type_init.add_statement (new CCodeExpressionStatement (add_class_private_call));
                }