summaryrefslogtreecommitdiff
path: root/codegen/valaccodeattribute.vala
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2017-08-22 15:31:54 +0200
committerRico Tzschichholz <ricotz@ubuntu.com>2017-08-27 13:27:27 +0200
commit3ee698c6e35ee3b05fdcd1aa846cb8cb4a39c0a6 (patch)
tree848c24d8721af1fe1f2f1ea531df5dbf226f30cb /codegen/valaccodeattribute.vala
parent5c12ee63704bbb3a897df157f9413005e7dadb0e (diff)
downloadvala-3ee698c6e35ee3b05fdcd1aa846cb8cb4a39c0a6.tar.gz
codegen: Use given dup_function for structs
Diffstat (limited to 'codegen/valaccodeattribute.vala')
-rw-r--r--codegen/valaccodeattribute.vala17
1 files changed, 17 insertions, 0 deletions
diff --git a/codegen/valaccodeattribute.vala b/codegen/valaccodeattribute.vala
index d3a97d520..815ec1104 100644
--- a/codegen/valaccodeattribute.vala
+++ b/codegen/valaccodeattribute.vala
@@ -222,6 +222,21 @@ public class Vala.CCodeAttribute : AttributeCache {
}
}
+ public string dup_function {
+ get {
+ if (!dup_function_set) {
+ if (ccode != null) {
+ _dup_function = ccode.get_string ("dup_function");
+ }
+ if (_dup_function == null && !sym.external_package && sym is Struct) {
+ _dup_function = "%sdup".printf (lower_case_prefix);
+ }
+ dup_function_set = true;
+ }
+ return _dup_function;
+ }
+ }
+
public string free_function {
get {
if (!free_function_set) {
@@ -541,6 +556,8 @@ public class Vala.CCodeAttribute : AttributeCache {
private bool copy_function_set;
private string? _destroy_function;
private bool destroy_function_set;
+ private string? _dup_function;
+ private bool dup_function_set;
private string? _free_function;
private bool free_function_set;
private bool? _free_function_address_of;