[vala/wip/attributes: 70/119] Drop TypeSymbol dup_function
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/attributes: 70/119] Drop TypeSymbol dup_function
- Date: Mon, 4 Jul 2011 10:27:58 +0000 (UTC)
commit 18b796dc63130d6b4fee8d406505a0f6c8596a06
Author: Luca Bruno <lucabru src gnome org>
Date: Wed Jun 29 21:31:11 2011 +0200
Drop TypeSymbol dup_function
codegen/valaccodebasemodule.vala | 9 ++++++++-
codegen/valatyperegisterfunction.vala | 2 +-
vala/valagirparser.vala | 2 +-
vala/valastruct.vala | 9 ---------
vala/valatypesymbol.vala | 12 ------------
5 files changed, 10 insertions(+), 24 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 8e9270c..8b6fe2a 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -5638,7 +5638,14 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
}
public static string get_ccode_dup_function (TypeSymbol sym) {
- return get_ccode_copy_function(sym);
+ if (sym is Struct) {
+ if (sym.external_package) {
+ return "";
+ } else {
+ return get_ccode_lower_case_prefix (sym) + "dup";
+ }
+ }
+ return get_ccode_copy_function (sym);
}
public static string get_ccode_free_function (TypeSymbol sym) {
diff --git a/codegen/valatyperegisterfunction.vala b/codegen/valatyperegisterfunction.vala
index a107c0a..a226683 100644
--- a/codegen/valatyperegisterfunction.vala
+++ b/codegen/valatyperegisterfunction.vala
@@ -162,7 +162,7 @@ public abstract class Vala.TypeRegisterFunction {
reg_call.add_argument (new CCodeConstant ("\"%s\"".printf (CCodeBaseModule.get_ccode_name (get_type_declaration ()))));
if (get_type_declaration () is Struct) {
var st = (Struct) get_type_declaration ();
- reg_call.add_argument (new CCodeCastExpression (new CCodeIdentifier (CCodeBaseModule.get_dup_function (st)), "GBoxedCopyFunc"));
+ reg_call.add_argument (new CCodeCastExpression (new CCodeIdentifier (CCodeBaseModule.get_ccode_dup_function (st)), "GBoxedCopyFunc"));
reg_call.add_argument (new CCodeCastExpression (new CCodeIdentifier (CCodeBaseModule.get_ccode_free_function (st)), "GBoxedFreeFunc"));
} else if (get_type_declaration () is Enum) {
var en = get_type_declaration () as Enum;
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 51f65cd..b2934f8 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -2610,7 +2610,7 @@ public class Vala.GirParser : CodeVisitor {
if (typeid != null) {
cl.set_type_id ("%s ()".printf (typeid));
cl.set_attribute_string ("CCode", "free_function", "g_boxed_free");
- cl.set_dup_function ("g_boxed_copy");
+ cl.set_attribute_string ("Ccode", "copy_function", "g_boxed_copy");
}
current.symbol = cl;
diff --git a/vala/valastruct.vala b/vala/valastruct.vala
index 2b5b4e6..a50180e 100644
--- a/vala/valastruct.vala
+++ b/vala/valastruct.vala
@@ -600,15 +600,6 @@ public class Vala.Struct : TypeSymbol {
return false;
}
- public override string? get_dup_function () {
- // TODO use attribute check instead
- if (external_package) {
- return null;
- } else {
- return get_lower_case_cprefix () + "dup";
- }
- }
-
public bool is_disposable () {
if (destroy_function != null) {
return true;
diff --git a/vala/valatypesymbol.vala b/vala/valatypesymbol.vala
index 29d58d9..8d709b3 100644
--- a/vala/valatypesymbol.vala
+++ b/vala/valatypesymbol.vala
@@ -50,18 +50,6 @@ public abstract class Vala.TypeSymbol : Symbol {
}
/**
- * Returns the C function name that duplicates instances of this data
- * type. The specified C function must accept one argument referencing
- * the instance of this data type and return a reference to the
- * duplicate.
- *
- * @return the name of the C function if supported or null otherwise
- */
- public virtual string? get_dup_function () {
- return null;
- }
-
- /**
* Returns the C symbol representing the runtime type id for this data
* type. The specified symbol must express a registered GType.
*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]