[vala] girparser: Make type arguments be owned by default
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] girparser: Make type arguments be owned by default
- Date: Wed, 18 May 2011 08:53:19 +0000 (UTC)
commit f71c43aa1def817ff1bf1a2f71701f7322217773
Author: Luca Bruno <lucabru src gnome org>
Date: Wed May 18 10:44:14 2011 +0200
girparser: Make type arguments be owned by default
The GIR format has no information on how to transfer ownership
of type arguments. Thus we assume that type arguments are unowned
only if transfer-ownership is "container".
vala/valagirparser.vala | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index d29851f..48b736e 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -1816,7 +1816,7 @@ public class Vala.GirParser : CodeVisitor {
string transfer = reader.get_attribute ("transfer-ownership");
string allow_none = reader.get_attribute ("allow-none");
next ();
- var transfer_elements = transfer == "full";
+ var transfer_elements = transfer != "container";
var type = parse_type (out ctype, null, transfer_elements);
if (transfer == "full" || transfer == "container") {
type.value_owned = true;
@@ -1876,7 +1876,7 @@ public class Vala.GirParser : CodeVisitor {
string ctype;
bool no_array_length;
bool array_null_terminated;
- var type = parse_type (out ctype, out array_length_idx, transfer == "full", out no_array_length, out array_null_terminated);
+ var type = parse_type (out ctype, out array_length_idx, transfer != "container", out no_array_length, out array_null_terminated);
if (transfer == "full" || transfer == "container" || destroy != null) {
type.value_owned = true;
}
@@ -1914,7 +1914,7 @@ public class Vala.GirParser : CodeVisitor {
return param;
}
- DataType parse_type (out string? ctype = null, out int array_length_idx = null, bool transfer_elements = false, out bool no_array_length = null, out bool array_null_terminated = null) {
+ DataType parse_type (out string? ctype = null, out int array_length_idx = null, bool transfer_elements = true, out bool no_array_length = null, out bool array_null_terminated = null) {
bool is_array = false;
string type_name = reader.get_attribute ("name");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]