[vala] Fix declarations of struct copy and free functions
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Subject: [vala] Fix declarations of struct copy and free functions
- Date: Mon, 27 Apr 2009 03:46:29 -0400 (EDT)
commit 507767eee6ab6ef3f34a5053c2cfb824d1008113
Author: Jürg Billeter <j bitron ch>
Date: Sun Apr 26 20:48:37 2009 +0200
Fix declarations of struct copy and free functions
---
gobject/valaccodestructmodule.vala | 39 ++++++++++++++++++++++++++++-------
1 files changed, 31 insertions(+), 8 deletions(-)
diff --git a/gobject/valaccodestructmodule.vala b/gobject/valaccodestructmodule.vala
index 7a61de8..8132c74 100644
--- a/gobject/valaccodestructmodule.vala
+++ b/gobject/valaccodestructmodule.vala
@@ -87,6 +87,37 @@ internal class Vala.CCodeStructModule : CCodeBaseModule {
decl_space.add_type_definition (new CCodeComment (st.source_reference.comment));
}
decl_space.add_type_definition (instance_struct);
+
+ var function = new CCodeFunction (st.get_dup_function (), st.get_cname () + "*");
+ if (st.is_private_symbol ()) {
+ function.modifiers = CCodeModifiers.STATIC;
+ }
+ function.add_parameter (new CCodeFormalParameter ("self", "const " + st.get_cname () + "*"));
+ decl_space.add_type_member_declaration (function);
+
+ function = new CCodeFunction (st.get_free_function (), "void");
+ if (st.is_private_symbol ()) {
+ function.modifiers = CCodeModifiers.STATIC;
+ }
+ function.add_parameter (new CCodeFormalParameter ("self", st.get_cname () + "*"));
+ decl_space.add_type_member_declaration (function);
+
+ if (st.is_disposable ()) {
+ function = new CCodeFunction (st.get_copy_function (), "void");
+ if (st.is_private_symbol ()) {
+ function.modifiers = CCodeModifiers.STATIC;
+ }
+ function.add_parameter (new CCodeFormalParameter ("self", "const " + st.get_cname () + "*"));
+ function.add_parameter (new CCodeFormalParameter ("dest", st.get_cname () + "*"));
+ decl_space.add_type_member_declaration (function);
+
+ function = new CCodeFunction (st.get_destroy_function (), "void");
+ if (st.is_private_symbol ()) {
+ function.modifiers = CCodeModifiers.STATIC;
+ }
+ function.add_parameter (new CCodeFormalParameter ("self", st.get_cname () + "*"));
+ decl_space.add_type_member_declaration (function);
+ }
}
public override void visit_struct (Struct st) {
@@ -124,8 +155,6 @@ internal class Vala.CCodeStructModule : CCodeBaseModule {
function.add_parameter (new CCodeFormalParameter ("self", "const " + st.get_cname () + "*"));
- source_declarations.add_type_member_declaration (function.copy ());
-
var cblock = new CCodeBlock ();
var cdecl = new CCodeDeclaration (st.get_cname () + "*");
@@ -170,8 +199,6 @@ internal class Vala.CCodeStructModule : CCodeBaseModule {
function.add_parameter (new CCodeFormalParameter ("self", st.get_cname () + "*"));
- source_declarations.add_type_member_declaration (function.copy ());
-
var cblock = new CCodeBlock ();
if (st.is_disposable ()) {
@@ -198,8 +225,6 @@ internal class Vala.CCodeStructModule : CCodeBaseModule {
function.add_parameter (new CCodeFormalParameter ("self", "const " + st.get_cname () + "*"));
function.add_parameter (new CCodeFormalParameter ("dest", st.get_cname () + "*"));
- source_declarations.add_type_member_declaration (function.copy ());
-
var cblock = new CCodeBlock ();
var cfrag = new CCodeFragment ();
cblock.add_statement (cfrag);
@@ -261,8 +286,6 @@ internal class Vala.CCodeStructModule : CCodeBaseModule {
function.add_parameter (new CCodeFormalParameter ("self", st.get_cname () + "*"));
- source_declarations.add_type_member_declaration (function.copy ());
-
var cblock = new CCodeBlock ();
cblock.add_statement (instance_finalize_fragment);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]