summaryrefslogtreecommitdiff
path: root/src/html/html_body_element.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/html/html_body_element.c')
-rw-r--r--src/html/html_body_element.c48
1 files changed, 15 insertions, 33 deletions
diff --git a/src/html/html_body_element.c b/src/html/html_body_element.c
index afe8ee4..d29c86c 100644
--- a/src/html/html_body_element.c
+++ b/src/html/html_body_element.c
@@ -5,6 +5,8 @@
* Copyright 2009 Bo Yang <struggleyb.nku.com>
*/
+#include <stdlib.h>
+
#include "html/html_body_element.h"
#include "core/node.h"
@@ -28,7 +30,7 @@ static struct dom_element_protected_vtable _protect_vtable = {
dom_exception _dom_html_body_element_create(struct dom_document *doc,
struct dom_html_body_element **ele)
{
- *ele = _dom_document_alloc(doc, NULL, sizeof(dom_html_body_element));
+ *ele = malloc(sizeof(dom_html_body_element));
if (*ele == NULL)
return DOM_NO_MEM_ERR;
@@ -50,17 +52,15 @@ dom_exception _dom_html_body_element_create(struct dom_document *doc,
dom_exception _dom_html_body_element_initialise(struct dom_document *doc,
struct dom_html_body_element *ele)
{
- const char *str = "BODY";
- lwc_string *name = NULL;
+ dom_string *name = NULL;
dom_exception err;
- err = _dom_document_create_lwcstring(doc, (const uint8_t *) str, SLEN(str),
- &name);
+ err = dom_string_create((const uint8_t *) "BODY", SLEN("BODY"), &name);
if (err != DOM_NO_ERR)
return err;
err = _dom_html_element_initialise(doc, &ele->base, name, NULL, NULL);
- _dom_document_unref_lwcstring(doc, name);
+ dom_string_unref(name);
return err;
}
@@ -68,26 +68,22 @@ dom_exception _dom_html_body_element_initialise(struct dom_document *doc,
/**
* Finalise a dom_html_body_element object
*
- * \param doc The document object
* \param ele The dom_html_body_element object
*/
-void _dom_html_body_element_finalise(struct dom_document *doc,
- struct dom_html_body_element *ele)
+void _dom_html_body_element_finalise(struct dom_html_body_element *ele)
{
- _dom_html_element_finalise(doc, &ele->base);
+ _dom_html_element_finalise(&ele->base);
}
/**
* Destroy a dom_html_body_element object
*
- * \param doc The document object
* \param ele The dom_html_body_element object
*/
-void _dom_html_body_element_destroy(struct dom_document *doc,
- struct dom_html_body_element *ele)
+void _dom_html_body_element_destroy(struct dom_html_body_element *ele)
{
- _dom_html_body_element_finalise(doc, ele);
- _dom_document_alloc(doc, ele, 0);
+ _dom_html_body_element_finalise(ele);
+ free(ele);
}
/*------------------------------------------------------------------------*/
@@ -111,27 +107,13 @@ dom_exception _dom_html_body_element_parse_attribute(dom_element *ele,
/* The virtual destroy function, see src/core/node.c for detail */
void _dom_virtual_html_body_element_destroy(dom_node_internal *node)
{
- struct dom_document *doc = dom_node_get_owner(node);
- _dom_html_body_element_destroy(doc, (struct dom_html_body_element *) node);
-}
-
-/* The virtual allocation function, see src/core/node.c for detail */
-dom_exception _dom_html_body_element_alloc(struct dom_document *doc,
- struct dom_node_internal *n, struct dom_node_internal **ret)
-{
- UNUSED(n);
-
- *ret = _dom_document_alloc(doc, NULL, sizeof(dom_html_body_element));
- if (*ret == NULL)
- return DOM_NO_MEM_ERR;
-
- return DOM_NO_ERR;
+ _dom_html_body_element_destroy((struct dom_html_body_element *) node);
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_body_element_copy(struct dom_node_internal *new,
- struct dom_node_internal *old)
+dom_exception _dom_html_body_element_copy(dom_node_internal *old,
+ dom_node_internal **copy)
{
- return _dom_html_element_copy(new, old);
+ return _dom_html_element_copy(old, copy);
}