]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Support void ref functions
authorJürg Billeter <j@bitron.ch>
Fri, 16 Jan 2009 16:04:41 +0000 (16:04 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Fri, 16 Jan 2009 16:04:41 +0000 (16:04 +0000)
2009-01-16  Jürg Billeter  <j@bitron.ch>

* 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

ChangeLog
vala/valacodewriter.vala
vapi/gconf-2.0.vapi
vapigen/valagidlparser.vala

index caa3ba0c48ebc38e3edd286d452c19132848a211..3b9048f8ce55de452dd3695a0cb3ca0e1a395d1c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2009-01-16  Jürg Billeter  <j@bitron.ch>
+
+       * 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  <j@bitron.ch>
 
        * gobject/valaccodestructmodule.vala:
index 248b3b3da2db2efda5393177bda6031250300ce5..f3730406eda7a60f8c42fbce2b6f22679e759cf8 100644 (file)
@@ -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 ()));
index 9e43ed9b8b47e86cc03a24f2ca1a0fd4f9f5c918..6902837d0f1b6712b022f538f0b7beb59cecb6e2 100644 (file)
@@ -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;
index 508f119a32b983a0772685db5d3bb26fb696c04e..75a27c9bca09f207dcd44e288d190c9656c4fbce 100644 (file)
@@ -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);