summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn-Mark Bell <jmb@netsurf-browser.org>2014-07-18 15:09:56 (GMT)
committer John-Mark Bell <jmb@netsurf-browser.org>2014-07-18 15:09:56 (GMT)
commit39069dc8b2c570c36a05e3fdaed81fa099dd8cdb (patch)
tree3784070ede3105c619ad94c8b53a78c5eca3033a
parentc47ab9c5fff7f6eb8567eb7fa776a505f6aaf78f (diff)
downloadlibdom-39069dc8b2c570c36a05e3fdaed81fa099dd8cdb.tar.gz
libdom-39069dc8b2c570c36a05e3fdaed81fa099dd8cdb.tar.bz2
Use the public API as it autoconverts types. Additionally, fix utterly bogus reference counting.
-rw-r--r--src/html/html_table_element.c66
1 files changed, 48 insertions, 18 deletions
diff --git a/src/html/html_table_element.c b/src/html/html_table_element.c
index 0f27fd3..25bb744 100644
--- a/src/html/html_table_element.c
+++ b/src/html/html_table_element.c
@@ -418,12 +418,22 @@ dom_exception dom_html_table_element_delete_caption(
dom_html_table_element *element)
{
dom_html_table_caption_element *caption;
- dom_html_table_element_get_caption(element, &caption);
- _dom_node_remove_child((dom_node_internal *)element,
- (dom_node_internal *)caption,
- (dom_node_internal **)&caption);
- element->caption = NULL;
- return DOM_NO_ERR;
+ dom_node *old_caption;
+ dom_exception err;
+
+ err = dom_html_table_element_get_caption(element, &caption);
+ if (err != DOM_NO_ERR)
+ return err;
+
+ err = dom_node_remove_child(element, caption, &old_caption);
+ if (err == DOM_NO_ERR) {
+ element->caption = NULL;
+ dom_node_unref(old_caption);
+ }
+
+ dom_node_unref(caption);
+
+ return err;
}
/**
@@ -473,12 +483,22 @@ dom_exception dom_html_table_element_delete_t_foot(
dom_html_table_element *element)
{
dom_html_table_section_element *t_foot;
- dom_html_table_element_get_t_foot(element, &t_foot);
- _dom_node_remove_child((dom_node_internal *)element,
- (dom_node_internal *)t_foot,
- (dom_node_internal **)&t_foot);
- element->t_foot = NULL;
- return DOM_NO_ERR;
+ dom_node *old_t_foot;
+ dom_exception err;
+
+ err = dom_html_table_element_get_t_foot(element, &t_foot);
+ if (err != DOM_NO_ERR)
+ return err;
+
+ err = dom_node_remove_child(element, t_foot, &old_t_foot);
+ if (err == DOM_NO_ERR) {
+ element->t_foot = NULL;
+ dom_node_unref(old_t_foot);
+ }
+
+ dom_node_unref(t_foot);
+
+ return err;
}
/**
@@ -525,12 +545,22 @@ dom_exception dom_html_table_element_delete_t_head(
dom_html_table_element *element)
{
dom_html_table_section_element *t_head;
- dom_html_table_element_get_t_head(element, &t_head);
- _dom_node_remove_child((dom_node_internal *)element,
- (dom_node_internal *)t_head,
- (dom_node_internal **)&t_head);
- element->t_head = NULL;
- return DOM_NO_ERR;
+ dom_node *old_t_head;
+ dom_exception err;
+
+ err = dom_html_table_element_get_t_head(element, &t_head);
+ if (err != DOM_NO_ERR)
+ return err;
+
+ err = dom_node_remove_child(element, t_head, &old_t_head);
+ if (err == DOM_NO_ERR) {
+ element->t_head = NULL;
+ dom_node_unref(old_t_head);
+ }
+
+ dom_node_unref(t_head);
+
+ return err;
}
/**