summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <michael.drake@codethink.co.uk>2016-02-05 16:55:55 (GMT)
committer Michael Drake <michael.drake@codethink.co.uk>2016-02-05 16:55:55 (GMT)
commit87d9b3fab8000f88022ab88fa44ffdbb0c73cd7e (patch)
treef6b9121e1d3378dd7b0e8076d7614e94ce4db399
parent07b7dd8f5f102cf6f6e2e492bf80f9a9eb798738 (diff)
downloadlibdom-87d9b3fab8000f88022ab88fa44ffdbb0c73cd7e.tar.gz
libdom-87d9b3fab8000f88022ab88fa44ffdbb0c73cd7e.tar.bz2
Fix: Proper copy constructor for HTMLLegendElement.
-rw-r--r--src/html/html_legend_element.c35
-rw-r--r--src/html/html_legend_element.h9
2 files changed, 41 insertions, 3 deletions
diff --git a/src/html/html_legend_element.c b/src/html/html_legend_element.c
index 842916f..efb712b 100644
--- a/src/html/html_legend_element.c
+++ b/src/html/html_legend_element.c
@@ -144,10 +144,39 @@ void _dom_virtual_html_legend_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_legend_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_legend_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_legend_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_legend_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_legend_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_legend_element_copy_internal(
+ dom_html_legend_element *old,
+ dom_html_legend_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_legend_element.h b/src/html/html_legend_element.h
index 50b9b51..226042a 100644
--- a/src/html/html_legend_element.h
+++ b/src/html/html_legend_element.h
@@ -49,5 +49,14 @@ dom_exception _dom_html_legend_element_copy(dom_node_internal *old,
_dom_virtual_html_legend_element_destroy, \
_dom_html_legend_element_copy
+/* Helper functions*/
+dom_exception _dom_html_legend_element_copy_internal(
+ dom_html_legend_element *old,
+ dom_html_legend_element *new);
+#define dom_html_legend_element_copy_internal(o, n) \
+ _dom_html_legend_element_copy_internal( \
+ (dom_html_legend_element *) (o), \
+ (dom_html_legend_element *) (n))
+
#endif