From c8b96a3990d4b581c50780d51f4be85996bba397 Mon Sep 17 00:00:00 2001 From: Richard Schwarting Date: Mon, 18 Nov 2013 11:27:34 -0500 Subject: [PATCH] Document.vala: document copy_node () --- gxml/Document.vala | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/gxml/Document.vala b/gxml/Document.vala index e76569ae..3f048bf3 100644 --- a/gxml/Document.vala +++ b/gxml/Document.vala @@ -1007,10 +1007,20 @@ namespace GXml { return (xmldoc->children != null); } + /** + * This is used to create a copy of a node. The node + * can come from another document but the copy will + * belong to this one. The copied node is owned by + * this document which will manage its memory. + * + * @param foreign_node A node from another document. + * @param deep Whether to clone its descendants + * + * @return An unowned reference to the copied node; this should not be freed + */ internal unowned Node copy_node (Node foreign_node, bool deep = true) { 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 - return this.lookup_node (our_copy_xml); // inducing a GXmlNode + return this.lookup_node (our_copy_xml); // inducing a GXmlNode for the xmlNode* } } } -- GitLab