[vala/0.46] girparser: Add required copy/free attributes for gtype-boxed structs
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.46] girparser: Add required copy/free attributes for gtype-boxed structs
- Date: Wed, 9 Oct 2019 08:56:39 +0000 (UTC)
commit de73b181f1aafd34689f0b9695ddf8eaeb5ff8ea
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Tue Oct 8 14:04:35 2019 +0200
girparser: Add required copy/free attributes for gtype-boxed structs
See https://gitlab.gnome.org/GNOME/vala/issues/863
vala/valagirparser.vala | 8 ++++++++
1 file changed, 8 insertions(+)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 36d249c90..259bf3d6c 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -2783,6 +2783,7 @@ public class Vala.GirParser : CodeVisitor {
push_node (element_get_name (), true);
Struct st;
+ bool require_copy_free = false;
if (current.new_symbol) {
st = new Struct (element_get_name (), current.source_reference);
current.symbol = st;
@@ -2791,6 +2792,7 @@ public class Vala.GirParser : CodeVisitor {
}
set_type_id_ccode (st);
+ require_copy_free = st.has_attribute_argument ("CCode", "type_id");
st.access = SymbolAccessibility.PUBLIC;
@@ -2840,6 +2842,12 @@ public class Vala.GirParser : CodeVisitor {
pop_metadata ();
}
+ // Add default g_boxed_copy/free ccode-attributes
+ if (require_copy_free) {
+ st.set_attribute_string ("CCode", "copy_function", "g_boxed_copy");
+ st.set_attribute_string ("CCode", "free_function", "g_boxed_free");
+ }
+
pop_node ();
end_element ("record");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]