summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <michael.drake@codethink.co.uk>2016-02-05 18:07:20 (GMT)
committer Michael Drake <michael.drake@codethink.co.uk>2016-02-05 18:07:20 (GMT)
commitafec57651ec64142437c9c3d2b72f46d75db6728 (patch)
treea66d42608d9acb665c001bb8c5611351a53863f4
parentf566b7cab8ffc9f4e959154a57bef91521f20d8a (diff)
downloadlibdom-afec57651ec64142437c9c3d2b72f46d75db6728.tar.gz
libdom-afec57651ec64142437c9c3d2b72f46d75db6728.tar.bz2
Fix: Proper copy constructor for HTMLTableSectionElement.
-rw-r--r--src/html/html_tablesection_element.c35
-rw-r--r--src/html/html_tablesection_element.h9
2 files changed, 41 insertions, 3 deletions
diff --git a/src/html/html_tablesection_element.c b/src/html/html_tablesection_element.c
index d570e1c..e17c86c 100644
--- a/src/html/html_tablesection_element.c
+++ b/src/html/html_tablesection_element.c
@@ -113,10 +113,39 @@ void _dom_virtual_html_table_section_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_table_section_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_table_section_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_table_section_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_table_section_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_table_section_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_table_section_element_copy_internal(
+ dom_html_table_section_element *old,
+ dom_html_table_section_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_tablesection_element.h b/src/html/html_tablesection_element.h
index 6985abd..9caf65e 100644
--- a/src/html/html_tablesection_element.h
+++ b/src/html/html_tablesection_element.h
@@ -49,6 +49,15 @@ dom_exception _dom_html_table_section_element_copy(dom_node_internal *old,
_dom_virtual_html_table_section_element_destroy, \
_dom_html_table_section_element_copy
+/* Helper functions*/
+dom_exception _dom_html_table_section_element_copy_internal(
+ dom_html_table_section_element *old,
+ dom_html_table_section_element *new);
+#define dom_html_table_section_element_copy_internal(o, n) \
+ _dom_html_table_section_element_copy_internal( \
+ (dom_html_table_section_element *) (o), \
+ (dom_html_table_section_element *) (n))
+
#endif
bool table_section_callback(struct dom_node_internal *node, void *ctx);