[gxml] Make clone_node's return value be an unowned Node; its memory is managed by its GXml.Document whose
- From: Richard Hans Schwarting <rschwart src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gxml] Make clone_node's return value be an unowned Node; its memory is managed by its GXml.Document whose
- Date: Sun, 29 Sep 2013 06:03:55 +0000 (UTC)
commit 2ae665c4613b13674280e6eb7ca8942ee03998a1
Author: Richard Schwarting <aquarichy gmail com>
Date: Sun Sep 29 01:57:04 2013 -0400
Make clone_node's return value be an unowned Node; its memory is managed by its GXml.Document whose
node_dict it lives in, and we don't want the caller to deal with its referencing
gxml/Attr.vala | 3 ++-
gxml/BackedNode.vala | 2 +-
gxml/Document.vala | 2 +-
gxml/Entity.vala | 3 ++-
gxml/Node.vala | 2 +-
5 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/gxml/Attr.vala b/gxml/Attr.vala
index 207acf4..c5ed1da 100644
--- a/gxml/Attr.vala
+++ b/gxml/Attr.vala
@@ -253,7 +253,8 @@ namespace GXml {
/**
* { inheritDoc}
*/
- public override Node? clone_node (bool deep) {
+ public override unowned Node? clone_node (bool deep) {
+ GLib.warning ("Cloning of Attrs not yet supported");
return this; // STUB
}
diff --git a/gxml/BackedNode.vala b/gxml/BackedNode.vala
index eb75926..4fd861b 100644
--- a/gxml/BackedNode.vala
+++ b/gxml/BackedNode.vala
@@ -290,7 +290,7 @@ namespace GXml {
/**
* { inheritDoc}
*/
- public override Node? clone_node (bool deep) {
+ public override unowned Node? clone_node (bool deep) {
return this.owner_document.copy_node (this, deep);
// TODO: add a better test, as we weren't realising this was just a stub; test for
memory usage too
}
diff --git a/gxml/Document.vala b/gxml/Document.vala
index a2ab4ad..8d49864 100644
--- a/gxml/Document.vala
+++ b/gxml/Document.vala
@@ -831,7 +831,7 @@ namespace GXml {
return (xmldoc->children != null);
}
- internal Node copy_node (Node foreign_node, bool deep = true) {
+ internal unowned Node copy_node (Node foreign_node, bool deep = true) {
foreign_node.owner_document.sync_dirty_elements ();
Xml.Node *our_copy_xml = ((BackedNode)foreign_node).node->doc_copy (this.xmldoc, deep
? 1 : 0);
// TODO: do we need to append this to this.new_nodes? Do we need to append the
result to this.nodes_to_free? Test memory implications
diff --git a/gxml/Entity.vala b/gxml/Entity.vala
index 97a7cf1..4a2f6c1 100644
--- a/gxml/Entity.vala
+++ b/gxml/Entity.vala
@@ -124,7 +124,8 @@ namespace GXml {
public override bool has_child_nodes () {
return (this.child_nodes.length > 0);
}
- public override Node? clone_node (bool deep) {
+ public override unowned Node? clone_node (bool deep) {
+ GLib.warning ("Cloning of Entity not yet supported");
return this; // STUB
}
diff --git a/gxml/Node.vala b/gxml/Node.vala
index 2f42e00..9123661 100644
--- a/gxml/Node.vala
+++ b/gxml/Node.vala
@@ -396,7 +396,7 @@ namespace GXml {
*
* @return A parentless clone of this node.
*/
- public virtual Node? clone_node (bool deep) {
+ public virtual unowned Node? clone_node (bool deep) {
return null;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]