From: Jürg Billeter Date: Fri, 16 Jan 2009 16:04:41 +0000 (+0000) Subject: Support void ref functions X-Git-Tag: VALA_0_5_6~33 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e59e97031a217e326018169e856dd5a570c1820a;p=thirdparty%2Fvala.git Support void ref functions 2009-01-16 Jürg Billeter * vala/valacodewriter.vala: Support void ref functions * vapigen/valagidlparser.vala: Detect void ref functions, patch by Andreas Brauchli, fixes bug 549061 * vapi/gconf-2.0.vapi: regenerated svn path=/trunk/; revision=2354 --- diff --git a/ChangeLog b/ChangeLog index caa3ba0c4..3b9048f8c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2009-01-16 Jürg Billeter + + * vala/valacodewriter.vala: + + Support void ref functions + + * vapigen/valagidlparser.vala: + + Detect void ref functions, patch by Andreas Brauchli, + fixes bug 549061 + + * vapi/gconf-2.0.vapi: regenerated + 2009-01-16 Jürg Billeter * gobject/valaccodestructmodule.vala: diff --git a/vala/valacodewriter.vala b/vala/valacodewriter.vala index 248b3b3da..f3730406e 100644 --- a/vala/valacodewriter.vala +++ b/vala/valacodewriter.vala @@ -135,6 +135,9 @@ public class Vala.CodeWriter : CodeVisitor { if (cl.is_reference_counting ()) { if (cl.base_class == null || cl.base_class.get_ref_function () == null || cl.base_class.get_ref_function () != cl.get_ref_function ()) { write_string ("ref_function = \"%s\", ".printf (cl.get_ref_function ())); + if (cl.ref_function_void) { + write_string ("ref_function_void = true, "); + } } if (cl.base_class == null || cl.base_class.get_unref_function () == null || cl.base_class.get_unref_function () != cl.get_unref_function ()) { write_string ("unref_function = \"%s\", ".printf (cl.get_unref_function ())); diff --git a/vapi/gconf-2.0.vapi b/vapi/gconf-2.0.vapi index 9e43ed9b8..6902837d0 100644 --- a/vapi/gconf-2.0.vapi +++ b/vapi/gconf-2.0.vapi @@ -3,7 +3,7 @@ [CCode (cprefix = "GConf", lower_case_cprefix = "gconf_")] namespace GConf { [Compact] - [CCode (ref_function = "gconf_change_set_ref", unref_function = "gconf_change_set_unref", cheader_filename = "gconf/gconf.h")] + [CCode (ref_function = "gconf_change_set_ref", ref_function_void = true, unref_function = "gconf_change_set_unref", cheader_filename = "gconf/gconf.h")] public class ChangeSet { public bool check_value (string key, out unowned GConf.Value value_retloc); public void clear (); @@ -86,7 +86,7 @@ namespace GConf { public virtual signal void value_changed (string key, void* value); } [Compact] - [CCode (ref_function = "gconf_engine_ref", unref_function = "gconf_engine_unref", cheader_filename = "gconf/gconf.h")] + [CCode (ref_function = "gconf_engine_ref", ref_function_void = true, unref_function = "gconf_engine_unref", cheader_filename = "gconf/gconf.h")] public class Engine { public unowned GLib.SList all_dirs (string dir) throws GLib.Error; public unowned GLib.SList all_entries (string dir) throws GLib.Error; @@ -129,7 +129,7 @@ namespace GConf { public bool unset (string key) throws GLib.Error; } [Compact] - [CCode (ref_function = "gconf_entry_ref", unref_function = "gconf_entry_unref", cheader_filename = "gconf/gconf.h")] + [CCode (ref_function = "gconf_entry_ref", ref_function_void = true, unref_function = "gconf_entry_unref", cheader_filename = "gconf/gconf.h")] public class Entry { public weak string key; public weak GConf.Value value; diff --git a/vapigen/valagidlparser.vala b/vapigen/valagidlparser.vala index 508f119a3..75a27c9bc 100644 --- a/vapigen/valagidlparser.vala +++ b/vapigen/valagidlparser.vala @@ -480,6 +480,7 @@ public class Vala.GIdlParser : CodeVisitor { current_data_type = cl; + bool ref_function_void = false; string ref_function = null; string unref_function = null; string copy_function = null; @@ -489,6 +490,7 @@ public class Vala.GIdlParser : CodeVisitor { if (member.type == IdlNodeTypeId.FUNCTION) { if (member.name == "ref") { ref_function = ((IdlNodeFunction) member).symbol; + ref_function_void = (parse_type (((IdlNodeFunction) member).result.type) is VoidType); } else if (member.name == "unref") { unref_function = ((IdlNodeFunction) member).symbol; } else if (member.name == "free" || member.name == "destroy") { @@ -512,6 +514,7 @@ public class Vala.GIdlParser : CodeVisitor { if (ref_function != null) { cl.set_ref_function (ref_function); + cl.ref_function_void = ref_function_void; } if (copy_function != null) { cl.set_dup_function (copy_function); @@ -603,6 +606,7 @@ public class Vala.GIdlParser : CodeVisitor { current_data_type = cl; + bool ref_function_void = false; string ref_function = null; string unref_function = null; string copy_function = null; @@ -612,6 +616,7 @@ public class Vala.GIdlParser : CodeVisitor { if (member.type == IdlNodeTypeId.FUNCTION) { if (member.name == "ref") { ref_function = ((IdlNodeFunction) member).symbol; + ref_function_void = (parse_type (((IdlNodeFunction) member).result.type) is VoidType); } else if (member.name == "unref") { unref_function = ((IdlNodeFunction) member).symbol; } else if (member.name == "free" || member.name == "destroy") { @@ -635,6 +640,7 @@ public class Vala.GIdlParser : CodeVisitor { if (ref_function != null) { cl.set_ref_function (ref_function); + cl.ref_function_void = ref_function_void; } if (copy_function != null) { cl.set_dup_function (copy_function); @@ -730,6 +736,7 @@ public class Vala.GIdlParser : CodeVisitor { current_data_type = cl; + bool ref_function_void = false; string ref_function = null; string unref_function = null; string copy_function = null; @@ -739,6 +746,7 @@ public class Vala.GIdlParser : CodeVisitor { if (member.type == IdlNodeTypeId.FUNCTION) { if (member.name == "ref") { ref_function = ((IdlNodeFunction) member).symbol; + ref_function_void = (parse_type (((IdlNodeFunction) member).result.type) is VoidType); } else if (member.name == "unref") { unref_function = ((IdlNodeFunction) member).symbol; } else if (member.name == "free" || member.name == "destroy") { @@ -762,6 +770,7 @@ public class Vala.GIdlParser : CodeVisitor { if (ref_function != null) { cl.set_ref_function (ref_function); + cl.ref_function_void = ref_function_void; } if (copy_function != null) { cl.set_dup_function (copy_function);