[vala/0.50] codegen: More use of get_ccode_type_name()
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.50] codegen: More use of get_ccode_type_name()
- Date: Sun, 14 Mar 2021 15:47:53 +0000 (UTC)
commit 9c9a56d66816a083c5c47eedaf38494268510893
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Wed Mar 3 10:05:00 2021 +0100
codegen: More use of get_ccode_type_name()
codegen/valaccodeattribute.vala | 2 +-
codegen/valaccodebasemodule.vala | 2 +-
codegen/valaccodemethodmodule.vala | 2 +-
codegen/valagtypemodule.vala | 26 +++++++++++++-------------
codegen/valatyperegisterfunction.vala | 2 +-
5 files changed, 17 insertions(+), 17 deletions(-)
---
diff --git a/codegen/valaccodeattribute.vala b/codegen/valaccodeattribute.vala
index 82c30b7f2..dfa03531c 100644
--- a/codegen/valaccodeattribute.vala
+++ b/codegen/valaccodeattribute.vala
@@ -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));
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index c2cecb2b0..15ae9e4fc 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -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");
diff --git a/codegen/valaccodemethodmodule.vala b/codegen/valaccodemethodmodule.vala
index 9777a5013..979eead1a 100644
--- a/codegen/valaccodemethodmodule.vala
+++ b/codegen/valaccodemethodmodule.vala
@@ -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);
}
}
diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala
index d6efb57aa..699aca8df 100644
--- a/codegen/valagtypemodule.vala
+++ b/codegen/valagtypemodule.vala
@@ -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;
diff --git a/codegen/valatyperegisterfunction.vala b/codegen/valatyperegisterfunction.vala
index eac326312..2150df0d7 100644
--- a/codegen/valatyperegisterfunction.vala
+++ b/codegen/valatyperegisterfunction.vala
@@ -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));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]