summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <michael.drake@codethink.co.uk>2016-02-05 18:20:57 (GMT)
committer Michael Drake <michael.drake@codethink.co.uk>2016-02-05 18:20:57 (GMT)
commit0f6942769b6d85b53e8348ed46c4b309d6b118bb (patch)
tree4139db87a503a4f70d70edf0667e27ca498a0afe
parent0480b0a22bdb1823eb1dae9d09ddc7308e7114ca (diff)
downloadlibdom-0f6942769b6d85b53e8348ed46c4b309d6b118bb.tar.gz
libdom-0f6942769b6d85b53e8348ed46c4b309d6b118bb.tar.bz2
Fix: Proper copy constructor for HTMLTitleElement.
-rw-r--r--src/html/html_title_element.c35
-rw-r--r--src/html/html_title_element.h9
2 files changed, 41 insertions, 3 deletions
diff --git a/src/html/html_title_element.c b/src/html/html_title_element.c
index 02c7820..39e898a 100644
--- a/src/html/html_title_element.c
+++ b/src/html/html_title_element.c
@@ -109,10 +109,39 @@ void _dom_virtual_html_title_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_title_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_title_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_title_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_title_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_title_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_title_element_copy_internal(
+ dom_html_title_element *old,
+ dom_html_title_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_title_element.h b/src/html/html_title_element.h
index 1a7653a..620171e 100644
--- a/src/html/html_title_element.h
+++ b/src/html/html_title_element.h
@@ -48,5 +48,14 @@ dom_exception _dom_html_title_element_copy(dom_node_internal *old,
_dom_virtual_html_title_element_destroy, \
_dom_html_title_element_copy
+/* Helper functions*/
+dom_exception _dom_html_title_element_copy_internal(
+ dom_html_title_element *old,
+ dom_html_title_element *new);
+#define dom_html_title_element_copy_internal(o, n) \
+ _dom_html_title_element_copy_internal( \
+ (dom_html_title_element *) (o), \
+ (dom_html_title_element *) (n))
+
#endif