Commit 507767ee authored by Jürg Billeter's avatar Jürg Billeter

Fix declarations of struct copy and free functions

parent c7c583bd
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment