summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorBo Yang <struggleyb.nku@gmail.com>2009-08-17 10:47:47 +0000
committerBo Yang <struggleyb.nku@gmail.com>2009-08-17 10:47:47 +0000
commit704b77565e0108982d2e2a26f572ce0b3eb85170 (patch)
tree429aaa8616fbcac702c2363b355af3be1144c522 /src/core
parentcdf9405a378693fe7fc95bb930cec3761be3ccc3 (diff)
downloadlibdom-704b77565e0108982d2e2a26f572ce0b3eb85170.tar.gz
libdom-704b77565e0108982d2e2a26f572ce0b3eb85170.tar.bz2
Split the _dom_element_destroy into two functions.
svn path=/trunk/dom/; revision=9330
Diffstat (limited to 'src/core')
-rw-r--r--src/core/element.c41
-rw-r--r--src/core/element.h2
2 files changed, 28 insertions, 15 deletions
diff --git a/src/core/element.c b/src/core/element.c
index 3b91e5f..eb76bc7 100644
--- a/src/core/element.c
+++ b/src/core/element.c
@@ -209,37 +209,48 @@ dom_exception _dom_element_initialise(struct dom_document *doc,
}
/**
- * Destroy an element
- *
- * \param doc The owning document
- * \param element The element to destroy
+ * Finalise a dom_element
*
- * The contents of ::element will be destroyed and ::element will be freed.
+ * \param doc The document
+ * \param ele The element
*/
-void _dom_element_destroy(struct dom_document *doc,
- struct dom_element *element)
+void _dom_element_finalise(struct dom_document *doc, struct dom_element *ele)
{
lwc_context *ctx = _dom_document_get_intern_context(doc);
assert (ctx != NULL);
/* Destroy attributes attached to this node */
- if (element->attributes != NULL) {
- _dom_hash_destroy(element->attributes, _key, ctx, _value, ctx);
- element->attributes = NULL;
+ if (ele->attributes != NULL) {
+ _dom_hash_destroy(ele->attributes, _key, ctx, _value, ctx);
+ ele->attributes = NULL;
}
- if (element->ns_attributes != NULL) {
- _dom_hash_destroy(element->ns_attributes, _key, ctx,
+ if (ele->ns_attributes != NULL) {
+ _dom_hash_destroy(ele->ns_attributes, _key, ctx,
_nsattributes, ctx);
- element->ns_attributes = NULL;
+ ele->ns_attributes = NULL;
}
- if (element->schema_type_info != NULL) {
+ if (ele->schema_type_info != NULL) {
/** \todo destroy schema type info */
}
/* Finalise base class */
- _dom_node_finalise(doc, &element->base);
+ _dom_node_finalise(doc, &ele->base);
+}
+
+/**
+ * Destroy an element
+ *
+ * \param doc The owning document
+ * \param element The element to destroy
+ *
+ * The contents of ::element will be destroyed and ::element will be freed.
+ */
+void _dom_element_destroy(struct dom_document *doc,
+ struct dom_element *element)
+{
+ _dom_element_finalise(doc, element);
/* Free the element */
_dom_document_alloc(doc, element, 0);
diff --git a/src/core/element.h b/src/core/element.h
index a5e338a..51e1268 100644
--- a/src/core/element.h
+++ b/src/core/element.h
@@ -47,6 +47,8 @@ dom_exception _dom_element_initialise(struct dom_document *doc,
struct dom_element *el, struct lwc_string_s *name,
struct lwc_string_s *namespace, struct lwc_string_s *prefix);
+void _dom_element_finalise(struct dom_document *doc, struct dom_element *ele);
+
void _dom_element_destroy(struct dom_document *doc,
struct dom_element *element);