diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/attr.c | 20 | ||||
-rw-r--r-- | src/core/attr.h | 17 | ||||
-rw-r--r-- | src/core/cdatasection.c | 2 | ||||
-rw-r--r-- | src/core/cdatasection.h | 4 | ||||
-rw-r--r-- | src/core/characterdata.c | 22 | ||||
-rw-r--r-- | src/core/characterdata.h | 14 | ||||
-rw-r--r-- | src/core/comment.c | 2 | ||||
-rw-r--r-- | src/core/comment.h | 3 | ||||
-rw-r--r-- | src/core/doc_fragment.c | 2 | ||||
-rw-r--r-- | src/core/doc_fragment.h | 3 | ||||
-rw-r--r-- | src/core/document.c | 50 | ||||
-rw-r--r-- | src/core/document.h | 54 | ||||
-rw-r--r-- | src/core/document_type.c | 20 | ||||
-rw-r--r-- | src/core/document_type.h | 18 | ||||
-rw-r--r-- | src/core/element.c | 102 | ||||
-rw-r--r-- | src/core/element.h | 59 | ||||
-rw-r--r-- | src/core/entity_ref.c | 4 | ||||
-rw-r--r-- | src/core/entity_ref.h | 5 | ||||
-rw-r--r-- | src/core/namednodemap.c | 12 | ||||
-rw-r--r-- | src/core/namednodemap.h | 13 | ||||
-rw-r--r-- | src/core/node.c | 42 | ||||
-rw-r--r-- | src/core/node.h | 46 | ||||
-rw-r--r-- | src/core/nodelist.h | 1 | ||||
-rw-r--r-- | src/core/pi.c | 2 | ||||
-rw-r--r-- | src/core/pi.h | 3 | ||||
-rw-r--r-- | src/core/string.c | 76 | ||||
-rw-r--r-- | src/core/string.h | 8 | ||||
-rw-r--r-- | src/core/text.c | 10 | ||||
-rw-r--r-- | src/core/text.h | 9 | ||||
-rw-r--r-- | src/core/typeinfo.c | 6 |
30 files changed, 310 insertions, 319 deletions
diff --git a/src/core/attr.c b/src/core/attr.c index b280057..937eec0 100644 --- a/src/core/attr.c +++ b/src/core/attr.c @@ -396,7 +396,7 @@ void dom_attr_mark_readonly(dom_attr *a) * finished with it. */ dom_exception _dom_attr_get_name(struct dom_attr *attr, - struct dom_string **result) + dom_string **result) { /* This is the same as nodeName */ return dom_node_get_node_name(attr, result); @@ -428,11 +428,11 @@ dom_exception _dom_attr_get_specified(struct dom_attr *attr, bool *result) * finished with it. */ dom_exception _dom_attr_get_value(struct dom_attr *attr, - struct dom_string **result) + dom_string **result) { struct dom_node_internal *a = (struct dom_node_internal *) attr; struct dom_node_internal *c; - struct dom_string *value, *temp; + dom_string *value, *temp; dom_exception err; err = _dom_document_create_string(a->owner, @@ -469,7 +469,7 @@ dom_exception _dom_attr_get_value(struct dom_attr *attr, /* Claim new value */ value = temp; } else if (c->type == DOM_ENTITY_REFERENCE_NODE) { - struct dom_string *tr; + dom_string *tr; /* Get textual representation of entity */ err = _dom_entity_reference_get_textual_representation( @@ -513,7 +513,7 @@ dom_exception _dom_attr_get_value(struct dom_attr *attr, * DOM_NO_MODIFICATION_ALLOWED_ERR if attribute is readonly. */ dom_exception _dom_attr_set_value(struct dom_attr *attr, - struct dom_string *value) + dom_string *value) { struct dom_node_internal *a = (struct dom_node_internal *) attr; struct dom_node_internal *c, *d; @@ -640,7 +640,7 @@ dom_exception _dom_attr_is_id(struct dom_attr *attr, bool *result) /* Overload function of Node, please refer node.c for the detail of this * function. */ dom_exception _dom_attr_get_node_value(dom_node_internal *node, - struct dom_string **result) + dom_string **result) { dom_attr *attr = (dom_attr *) node; @@ -674,7 +674,7 @@ dom_exception _dom_attr_clone_node(dom_node_internal *node, bool deep, /* Overload function of Node, please refer node.c for the detail of this * function. */ dom_exception _dom_attr_set_prefix(dom_node_internal *node, - struct dom_string *prefix) + dom_string *prefix) { /* Really I don't know whether there should something * special to do here */ @@ -684,7 +684,7 @@ dom_exception _dom_attr_set_prefix(dom_node_internal *node, /* Overload function of Node, please refer node.c for the detail of this * function. */ dom_exception _dom_attr_lookup_prefix(dom_node_internal *node, - struct dom_string *namespace, struct dom_string **result) + dom_string *namespace, dom_string **result) { struct dom_element *owner; dom_exception err; @@ -704,7 +704,7 @@ dom_exception _dom_attr_lookup_prefix(dom_node_internal *node, /* Overload function of Node, please refer node.c for the detail of this * function. */ dom_exception _dom_attr_is_default_namespace(dom_node_internal *node, - struct dom_string *namespace, bool *result) + dom_string *namespace, bool *result) { struct dom_element *owner; dom_exception err; @@ -724,7 +724,7 @@ dom_exception _dom_attr_is_default_namespace(dom_node_internal *node, /* Overload function of Node, please refer node.c for the detail of this * function. */ dom_exception _dom_attr_lookup_namespace(dom_node_internal *node, - struct dom_string *prefix, struct dom_string **result) + dom_string *prefix, dom_string **result) { struct dom_element *owner; dom_exception err; diff --git a/src/core/attr.h b/src/core/attr.h index b94715a..0d4621a 100644 --- a/src/core/attr.h +++ b/src/core/attr.h @@ -11,7 +11,6 @@ #include <dom/core/attr.h> struct dom_document; -struct dom_string; struct dom_type_info; struct lwc_string_s; @@ -28,12 +27,12 @@ void _dom_attr_finalise(struct dom_document *doc, struct dom_attr *attr); /* Virtual functions for dom_attr */ dom_exception _dom_attr_get_name(struct dom_attr *attr, - struct dom_string **result); + dom_string **result); dom_exception _dom_attr_get_specified(struct dom_attr *attr, bool *result); dom_exception _dom_attr_get_value(struct dom_attr *attr, - struct dom_string **result); + dom_string **result); dom_exception _dom_attr_set_value(struct dom_attr *attr, - struct dom_string *value); + dom_string *value); dom_exception _dom_attr_get_owner(struct dom_attr *attr, struct dom_element **result); dom_exception _dom_attr_get_schema_type_info(struct dom_attr *attr, @@ -51,18 +50,18 @@ dom_exception _dom_attr_is_id(struct dom_attr *attr, bool *result); /* Overloading dom_node functions */ dom_exception _dom_attr_get_node_value(dom_node_internal *node, - struct dom_string **result); + dom_string **result); dom_exception _dom_attr_clone_node(dom_node_internal *node, bool deep, dom_node_internal **result); dom_exception _dom_attr_set_prefix(dom_node_internal *node, - struct dom_string *prefix); + dom_string *prefix); dom_exception _dom_attr_normalize(dom_node_internal *node); dom_exception _dom_attr_lookup_prefix(dom_node_internal *node, - struct dom_string *namespace, struct dom_string **result); + dom_string *namespace, dom_string **result); dom_exception _dom_attr_is_default_namespace(dom_node_internal *node, - struct dom_string *namespace, bool *result); + dom_string *namespace, bool *result); dom_exception _dom_attr_lookup_namespace(dom_node_internal *node, - struct dom_string *prefix, struct dom_string **result); + dom_string *prefix, dom_string **result); #define DOM_NODE_VTABLE_ATTR \ _dom_node_get_node_name, \ _dom_attr_get_node_value, /*overload*/\ diff --git a/src/core/cdatasection.c b/src/core/cdatasection.c index b470df2..7417ebf 100644 --- a/src/core/cdatasection.c +++ b/src/core/cdatasection.c @@ -37,7 +37,7 @@ static struct dom_node_protect_vtable cdata_section_protect_vtable = { * The returned node will already be referenced. */ dom_exception _dom_cdata_section_create(struct dom_document *doc, - struct lwc_string_s *name, struct dom_string *value, + struct lwc_string_s *name, dom_string *value, struct dom_cdata_section **result) { struct dom_cdata_section *c; diff --git a/src/core/cdatasection.h b/src/core/cdatasection.h index 94d45a2..04a0954 100644 --- a/src/core/cdatasection.h +++ b/src/core/cdatasection.h @@ -10,15 +10,15 @@ #include <dom/core/exceptions.h> #include <dom/core/cdatasection.h> +#include <dom/core/string.h> struct dom_node_internal; struct dom_cdata_section; struct dom_document; -struct dom_string; struct lwc_string_s; dom_exception _dom_cdata_section_create(struct dom_document *doc, - struct lwc_string_s *name, struct dom_string *value, + struct lwc_string_s *name, dom_string *value, struct dom_cdata_section **result); void _dom_cdata_section_destroy(struct dom_document *doc, diff --git a/src/core/characterdata.c b/src/core/characterdata.c index 05d12ea..824e0dc 100644 --- a/src/core/characterdata.c +++ b/src/core/characterdata.c @@ -57,7 +57,7 @@ dom_characterdata *_dom_characterdata_create(struct dom_document *doc) */ dom_exception _dom_characterdata_initialise(struct dom_characterdata *cdata, struct dom_document *doc, dom_node_type type, - lwc_string *name, struct dom_string *value) + lwc_string *name, dom_string *value) { return _dom_node_initialise(&cdata->base, doc, type, name, value, NULL, NULL); @@ -97,7 +97,7 @@ void _dom_characterdata_finalise(struct dom_document *doc, * this implementation; dom_strings are unbounded. */ dom_exception _dom_characterdata_get_data(struct dom_characterdata *cdata, - struct dom_string **data) + dom_string **data) { struct dom_node_internal *c = (struct dom_node_internal *) cdata; @@ -122,7 +122,7 @@ dom_exception _dom_characterdata_get_data(struct dom_characterdata *cdata, * a reference on the string). The node's existing content will be unrefed. */ dom_exception _dom_characterdata_set_data(struct dom_characterdata *cdata, - struct dom_string *data) + dom_string *data) { struct dom_node_internal *c = (struct dom_node_internal *) cdata; @@ -192,7 +192,7 @@ dom_exception _dom_characterdata_get_length(struct dom_characterdata *cdata, */ dom_exception _dom_characterdata_substring_data( struct dom_characterdata *cdata, unsigned long offset, - unsigned long count, struct dom_string **data) + unsigned long count, dom_string **data) { struct dom_node_internal *c = (struct dom_node_internal *) cdata; uint32_t len, end; @@ -225,10 +225,10 @@ dom_exception _dom_characterdata_substring_data( * DOM_NO_MODIFICATION_ALLOWED_ERR if ::cdata is readonly. */ dom_exception _dom_characterdata_append_data(struct dom_characterdata *cdata, - struct dom_string *data) + dom_string *data) { struct dom_node_internal *c = (struct dom_node_internal *) cdata; - struct dom_string *temp; + dom_string *temp; dom_exception err; if (_dom_node_readonly(c)) { @@ -271,10 +271,10 @@ dom_exception _dom_characterdata_append_data(struct dom_characterdata *cdata, * DOM_NO_MODIFICATION_ALLOWED_ERR if ::cdata is readonly. */ dom_exception _dom_characterdata_insert_data(struct dom_characterdata *cdata, - unsigned long offset, struct dom_string *data) + unsigned long offset, dom_string *data) { struct dom_node_internal *c = (struct dom_node_internal *) cdata; - struct dom_string *temp; + dom_string *temp; uint32_t len; dom_exception err; @@ -335,7 +335,7 @@ dom_exception _dom_characterdata_delete_data(struct dom_characterdata *cdata, unsigned long offset, unsigned long count) { struct dom_node_internal *c = (struct dom_node_internal *) cdata; - struct dom_string *temp; + dom_string *temp; uint32_t len, end; dom_exception err; @@ -397,10 +397,10 @@ dom_exception _dom_characterdata_delete_data(struct dom_characterdata *cdata, */ dom_exception _dom_characterdata_replace_data(struct dom_characterdata *cdata, unsigned long offset, unsigned long count, - struct dom_string *data) + dom_string *data) { struct dom_node_internal *c = (struct dom_node_internal *) cdata; - struct dom_string *temp; + dom_string *temp; uint32_t len, end; dom_exception err; diff --git a/src/core/characterdata.h b/src/core/characterdata.h index b5886ea..da8772d 100644 --- a/src/core/characterdata.h +++ b/src/core/characterdata.h @@ -24,30 +24,30 @@ struct dom_characterdata { dom_characterdata *_dom_characterdata_create(struct dom_document *doc); dom_exception _dom_characterdata_initialise(struct dom_characterdata *cdata, struct dom_document *doc, dom_node_type type, - struct lwc_string_s *name, struct dom_string *value); + struct lwc_string_s *name, dom_string *value); void _dom_characterdata_finalise(struct dom_document *doc, struct dom_characterdata *cdata); /* The virtual functions for dom_characterdata */ dom_exception _dom_characterdata_get_data(struct dom_characterdata *cdata, - struct dom_string **data); + dom_string **data); dom_exception _dom_characterdata_set_data(struct dom_characterdata *cdata, - struct dom_string *data); + dom_string *data); dom_exception _dom_characterdata_get_length(struct dom_characterdata *cdata, unsigned long *length); dom_exception _dom_characterdata_substring_data( struct dom_characterdata *cdata, unsigned long offset, - unsigned long count, struct dom_string **data); + unsigned long count, dom_string **data); dom_exception _dom_characterdata_append_data(struct dom_characterdata *cdata, - struct dom_string *data); + dom_string *data); dom_exception _dom_characterdata_insert_data(struct dom_characterdata *cdata, - unsigned long offset, struct dom_string *data); + unsigned long offset, dom_string *data); dom_exception _dom_characterdata_delete_data(struct dom_characterdata *cdata, unsigned long offset, unsigned long count); dom_exception _dom_characterdata_replace_data(struct dom_characterdata *cdata, unsigned long offset, unsigned long count, - struct dom_string *data); + dom_string *data); #define DOM_CHARACTERDATA_VTABLE \ _dom_characterdata_get_data, \ diff --git a/src/core/comment.c b/src/core/comment.c index 564bcd8..ab49a66 100644 --- a/src/core/comment.c +++ b/src/core/comment.c @@ -38,7 +38,7 @@ static struct dom_node_protect_vtable comment_protect_vtable = { * The returned node will already be referenced. */ dom_exception _dom_comment_create(struct dom_document *doc, - struct lwc_string_s *name, struct dom_string *value, + struct lwc_string_s *name, dom_string *value, struct dom_comment **result) { struct dom_comment *c; diff --git a/src/core/comment.h b/src/core/comment.h index ef8791f..1951732 100644 --- a/src/core/comment.h +++ b/src/core/comment.h @@ -13,11 +13,10 @@ struct dom_comment; struct dom_document; -struct dom_string; struct lwc_string_s; dom_exception _dom_comment_create(struct dom_document *doc, - struct lwc_string_s *name, struct dom_string *value, + struct lwc_string_s *name, dom_string *value, struct dom_comment **result); #define _dom_comment_initialise _dom_characterdata_initialise diff --git a/src/core/doc_fragment.c b/src/core/doc_fragment.c index 6b46696..1d320b5 100644 --- a/src/core/doc_fragment.c +++ b/src/core/doc_fragment.c @@ -45,7 +45,7 @@ static struct dom_node_protect_vtable df_protect_vtable = { * The returned node will already be referenced. */ dom_exception _dom_document_fragment_create(struct dom_document *doc, - struct lwc_string_s *name, struct dom_string *value, + struct lwc_string_s *name, dom_string *value, struct dom_document_fragment **result) { struct dom_document_fragment *f; diff --git a/src/core/doc_fragment.h b/src/core/doc_fragment.h index 9d3de76..b2c3e71 100644 --- a/src/core/doc_fragment.h +++ b/src/core/doc_fragment.h @@ -12,11 +12,10 @@ struct dom_document_fragment; struct dom_document; -struct dom_string; struct lwc_string_s; dom_exception _dom_document_fragment_create(struct dom_document *doc, - struct lwc_string_s *name, struct dom_string *value, + struct lwc_string_s *name, dom_string *value, struct dom_document_fragment **result); void _dom_document_fragment_destroy(struct dom_document *doc, diff --git a/src/core/document.c b/src/core/document.c index 20ad789..b671c30 100644 --- a/src/core/document.c +++ b/src/core/document.c @@ -285,7 +285,7 @@ dom_exception _dom_document_get_document_element(struct dom_document *doc, * finished with it. */ dom_exception _dom_document_create_element(struct dom_document *doc, - struct dom_string *tag_name, struct dom_element **result) + dom_string *tag_name, struct dom_element **result) { lwc_string *name; dom_exception err; @@ -345,7 +345,7 @@ dom_exception _dom_document_create_document_fragment(struct dom_document *doc, * finished with it. */ dom_exception _dom_document_create_text_node(struct dom_document *doc, - struct dom_string *data, struct dom_text **result) + dom_string *data, struct dom_text **result) { lwc_string *name; dom_exception err; @@ -374,7 +374,7 @@ dom_exception _dom_document_create_text_node(struct dom_document *doc, * finished with it. */ dom_exception _dom_document_create_comment(struct dom_document *doc, - struct dom_string *data, struct dom_comment **result) + dom_string *data, struct dom_comment **result) { lwc_string *name; dom_exception err; @@ -405,7 +405,7 @@ dom_exception _dom_document_create_comment(struct dom_document *doc, * finished with it. */ dom_exception _dom_document_create_cdata_section(struct dom_document *doc, - struct dom_string *data, struct dom_cdata_section **result) + dom_string *data, struct dom_cdata_section **result) { lwc_string *name; dom_exception err; @@ -438,8 +438,8 @@ dom_exception _dom_document_create_cdata_section(struct dom_document *doc, * finished with it. */ dom_exception _dom_document_create_processing_instruction( - struct dom_document *doc, struct dom_string *target, - struct dom_string *data, + struct dom_document *doc, dom_string *target, + dom_string *data, struct dom_processing_instruction **result) { lwc_string *name; @@ -472,7 +472,7 @@ dom_exception _dom_document_create_processing_instruction( * finished with it. */ dom_exception _dom_document_create_attribute(struct dom_document *doc, - struct dom_string *name, struct dom_attr **result) + dom_string *name, struct dom_attr **result) { lwc_string *n; dom_exception err; @@ -504,7 +504,7 @@ dom_exception _dom_document_create_attribute(struct dom_document *doc, * finished with it. */ dom_exception _dom_document_create_entity_reference(struct dom_document *doc, - struct dom_string *name, + dom_string *name, struct dom_entity_reference **result) { lwc_string *n; @@ -535,7 +535,7 @@ dom_exception _dom_document_create_entity_reference(struct dom_document *doc, * finished with it. */ dom_exception _dom_document_get_elements_by_tag_name(struct dom_document *doc, - struct dom_string *tagname, struct dom_nodelist **result) + dom_string *tagname, struct dom_nodelist **result) { lwc_string *name; dom_exception err; @@ -605,10 +605,10 @@ dom_exception _dom_document_import_node(struct dom_document *doc, * finished with it. */ dom_exception _dom_document_create_element_ns(struct dom_document *doc, - struct dom_string *namespace, struct dom_string *qname, + dom_string *namespace, dom_string *qname, struct dom_element **result) { - struct dom_string *prefix, *localname; + dom_string *prefix, *localname; dom_exception err; if (_dom_validate_name(qname) == false) @@ -710,10 +710,10 @@ dom_exception _dom_document_create_element_ns(struct dom_document *doc, * finished with it. */ dom_exception _dom_document_create_attribute_ns(struct dom_document *doc, - struct dom_string *namespace, struct dom_string *qname, + dom_string *namespace, dom_string *qname, struct dom_attr **result) { - struct dom_string *prefix, *localname; + dom_string *prefix, *localname; dom_exception err; if (_dom_validate_name(qname) == false) @@ -799,8 +799,8 @@ dom_exception _dom_document_create_attribute_ns(struct dom_document *doc, * finished with it. */ dom_exception _dom_document_get_elements_by_tag_name_ns( - struct dom_document *doc, struct dom_string *namespace, - struct dom_string *localname, struct dom_nodelist **result) + struct dom_document *doc, dom_string *namespace, + dom_string *localname, struct dom_nodelist **result) { dom_exception err; lwc_string *l = NULL, *n = NULL; @@ -843,7 +843,7 @@ dom_exception _dom_document_get_elements_by_tag_name_ns( * finished with it. */ dom_exception _dom_document_get_element_by_id(struct dom_document *doc, - struct dom_string *id, struct dom_element **result) + dom_string *id, struct dom_element **result) { lwc_string *i; dom_node_internal *root; @@ -877,7 +877,7 @@ dom_exception _dom_document_get_element_by_id(struct dom_document *doc, * finished with it. */ dom_exception _dom_document_get_input_encoding(struct dom_document *doc, - struct dom_string **result) + dom_string **result) { UNUSED(doc); UNUSED(result); @@ -897,7 +897,7 @@ dom_exception _dom_document_get_input_encoding(struct dom_document *doc, * finished with it. */ dom_exception _dom_document_get_xml_encoding(struct dom_document *doc, - struct dom_string **result) + dom_string **result) { UNUSED(doc); UNUSED(result); @@ -957,7 +957,7 @@ dom_exception _dom_document_set_xml_standalone(struct dom_document *doc, * DOM_NOT_SUPPORTED_ERR. */ dom_exception _dom_document_get_xml_version(struct dom_document *doc, - struct dom_string **result) + dom_string **result) { UNUSED(doc); UNUSED(result); @@ -978,7 +978,7 @@ dom_exception _dom_document_get_xml_version(struct dom_document *doc, * DOM_NOT_SUPPORTED_ERR. */ dom_exception _dom_document_set_xml_version(struct dom_document *doc, - struct dom_string *version) + dom_string *version) { UNUSED(doc); UNUSED(version); @@ -1030,7 +1030,7 @@ dom_exception _dom_document_set_strict_error_checking( * finished with it. */ dom_exception _dom_document_get_uri(struct dom_document *doc, - struct dom_string **result) + dom_string **result) { dom_string_ref(doc->uri); *result = doc->uri; @@ -1050,7 +1050,7 @@ dom_exception _dom_document_get_uri(struct dom_document *doc, * finished with it. */ dom_exception _dom_document_set_uri(struct dom_document *doc, - struct dom_string *uri) + dom_string *uri) { dom_string_unref(doc->uri); dom_string_ref(uri); @@ -1200,7 +1200,7 @@ dom_exception _dom_document_normalize(struct dom_document *doc) */ dom_exception _dom_document_rename_node(struct dom_document *doc, struct dom_node *node, - struct dom_string *namespace, struct dom_string *qname, + dom_string *namespace, dom_string *qname, struct dom_node **result) { UNUSED(doc); @@ -1273,7 +1273,7 @@ dom_exception _dom_document_copy(struct dom_node_internal *new, * returned DOM string. */ dom_exception _dom_document_create_string(struct dom_document *doc, - const uint8_t *data, size_t len, struct dom_string **result) + const uint8_t *data, size_t len, dom_string **result) { return dom_string_create(doc->alloc, doc->pw, data, len, result); } @@ -1333,7 +1333,7 @@ void _dom_document_get_allocator(struct dom_document *doc, dom_alloc *al, */ dom_exception _dom_document_create_string_from_lwcstring( struct dom_document *doc, struct lwc_string_s *str, - struct dom_string **result) + dom_string **result) { return _dom_string_create_from_lwcstring(doc->alloc, doc->pw, str, result); diff --git a/src/core/document.h b/src/core/document.h index 3939f9a..911b89f 100644 --- a/src/core/document.h +++ b/src/core/document.h @@ -52,7 +52,7 @@ struct dom_document { struct dom_doc_nl *nodelists; /**< List of active nodelists */ - struct dom_string *uri; /**< The uri of this document */ + dom_string *uri; /**< The uri of this document */ dom_alloc alloc; /**< Memory (de)allocation function */ void *pw; /**< Pointer to client data */ @@ -81,7 +81,7 @@ bool _dom_document_finalise(struct dom_document *doc); /* Create a dom_string from C string */ dom_exception _dom_document_create_string(struct dom_document *doc, - const uint8_t *data, size_t len, struct dom_string **result); + const uint8_t *data, size_t len, dom_string **result); /* Create a lwc_string from C string */ dom_exception _dom_document_create_lwcstring(struct dom_document *doc, const uint8_t *data, size_t len, struct lwc_string_s **result); @@ -91,7 +91,7 @@ void _dom_document_unref_lwcstring(struct dom_document *doc, /* Create a dom_string from a lwc_string */ dom_exception _dom_document_create_string_from_lwcstring( struct dom_document *doc, struct lwc_string_s *str, - struct dom_string **result); + dom_string **result); /* Begin the virtual functions */ @@ -102,59 +102,59 @@ dom_exception _dom_document_get_implementation(struct dom_document *doc, dom_exception _dom_document_get_document_element(struct dom_document *doc, struct dom_element **result); dom_exception _dom_document_create_element(struct dom_document *doc, - struct dom_string *tag_name, struct dom_element **result); + dom_string *tag_name, struct dom_element **result); dom_exception _dom_document_create_document_fragment(struct dom_document *doc, struct dom_document_fragment **result); dom_exception _dom_document_create_text_node(struct dom_document *doc, - struct dom_string *data, struct dom_text **result); + dom_string *data, struct dom_text **result); dom_exception _dom_document_create_comment(struct dom_document *doc, - struct dom_string *data, struct dom_comment **result); + dom_string *data, struct dom_comment **result); dom_exception _dom_document_create_cdata_section(struct dom_document *doc, - struct dom_string *data, struct dom_cdata_section **result); + dom_string *data, struct dom_cdata_section **result); dom_exception _dom_document_create_processing_instruction( - struct dom_document *doc, struct dom_string *target, - struct dom_string *data, + struct dom_document *doc, dom_string *target, + dom_string *data, struct dom_processing_instruction **result); dom_exception _dom_document_create_attribute(struct dom_document *doc, - struct dom_string *name, struct dom_attr **result); + dom_string *name, struct dom_attr **result); dom_exception _dom_document_create_entity_reference(struct dom_document *doc, - struct dom_string *name, + dom_string *name, struct dom_entity_reference **result); dom_exception _dom_document_get_elements_by_tag_name(struct dom_document *doc, - struct dom_string *tagname, struct dom_nodelist **result); + dom_string *tagname, struct dom_nodelist **result); dom_exception _dom_document_import_node(struct dom_document *doc, struct dom_node *node, bool deep, struct dom_node **result); dom_exception _dom_document_create_element_ns(struct dom_document *doc, - struct dom_string *namespace, struct dom_string *qname, + dom_string *namespace, dom_string *qname, struct dom_element **result); dom_exception _dom_document_create_attribute_ns(struct dom_document *doc, - struct dom_string *namespace, struct dom_string *qname, + dom_string *namespace, dom_string *qname, struct dom_attr **result); dom_exception _dom_document_get_elements_by_tag_name_ns( - struct dom_document *doc, struct dom_string *namespace, - struct dom_string *localname, struct dom_nodelist **result); + struct dom_document *doc, dom_string *namespace, + dom_string *localname, struct dom_nodelist **result); dom_exception _dom_document_get_element_by_id(struct dom_document *doc, - struct dom_string *id, struct dom_element **result); + dom_string *id, struct dom_element **result); dom_exception _dom_document_get_input_encoding(struct dom_document *doc, - struct dom_string **result); + dom_string **result); dom_exception _dom_document_get_xml_encoding(struct dom_document *doc, - struct dom_string **result); + dom_string **result); dom_exception _dom_document_get_xml_standalone(struct dom_document *doc, bool *result); dom_exception _dom_document_set_xml_standalone(struct dom_document *doc, bool standalone); dom_exception _dom_document_get_xml_version(struct dom_document *doc, - struct dom_string **result); + dom_string **result); dom_exception _dom_document_set_xml_version(struct dom_document *doc, - struct dom_string *version); + dom_string *version); dom_exception _dom_document_get_strict_error_checking( struct dom_document *doc, bool *result); dom_exception _dom_document_set_strict_error_checking( struct dom_document *doc, bool strict); dom_exception _dom_document_get_uri(struct dom_document *doc, - struct dom_string **result); + dom_string **result); dom_exception _dom_document_set_uri(struct dom_document *doc, - struct dom_string *uri); + dom_string *uri); dom_exception _dom_document_adopt_node(struct dom_document *doc, struct dom_node *node, struct dom_node **result); dom_exception _dom_document_get_dom_config(struct dom_document *doc, @@ -162,7 +162,7 @@ dom_exception _dom_document_get_dom_config(struct dom_document *doc, dom_exception _dom_document_normalize(struct dom_document *doc); dom_exception _dom_document_rename_node(struct dom_document *doc, struct dom_node *node, - struct dom_string *namespace, struct dom_string *qname, + dom_string *namespace, dom_string *qname, struct dom_node **result); #define DOM_DOCUMENT_VTABLE \ @@ -205,7 +205,7 @@ dom_exception _dom_document_rename_node(struct dom_document *doc, struct dom_document_protected_vtable { struct dom_node_protect_vtable base; dom_exception (*dom_document_get_base)(dom_document *doc, - struct dom_string **base_uri); + dom_string **base_uri); /* Get the document's base uri */ }; @@ -213,14 +213,14 @@ typedef struct dom_document_protected_vtable dom_document_protected_vtable; /* Get the document's base URI */ static inline dom_exception dom_document_get_base(dom_document *doc, - struct dom_string **base_uri) + dom_string **base_uri) { struct dom_node_internal *node = (struct dom_node_internal *) doc; return ((dom_document_protected_vtable *) node->vtable)-> dom_document_get_base(doc, base_uri); } #define dom_document_get_base(d, b) dom_document_get_base( \ - (dom_document *) (d), (struct dom_string **) (b)) + (dom_document *) (d), (dom_string **) (b)) /* Following comes the protected vtable */ void _dom_document_destroy(struct dom_node_internal *node); diff --git a/src/core/document_type.c b/src/core/document_type.c index 7788b1d..cfec29d 100644 --- a/src/core/document_type.c +++ b/src/core/document_type.c @@ -24,8 +24,8 @@ struct dom_document_type { struct dom_node_internal base; /**< Base node */ - struct dom_string *public_id; /**< Doctype public ID */ - struct dom_string *system_id; /**< Doctype system ID */ + dom_string *public_id; /**< Doctype public ID */ + dom_string *system_id; /**< Doctype system ID */ struct dom_resource_mgr res; /**< resource_mgr of this node */ }; @@ -61,8 +61,8 @@ static struct dom_node_protect_vtable dt_protect_vtable = { * explicitly. The client must unref the doctype once it has * finished with it. */ -dom_exception _dom_document_type_create(struct dom_string *qname, - struct dom_string *public_id, struct dom_string *system_id, +dom_exception _dom_document_type_create(dom_string *qname, + dom_string *public_id, dom_string *system_id, dom_alloc alloc, void *pw, struct dom_document_type **doctype) { @@ -107,8 +107,8 @@ void _dom_document_type_destroy(struct dom_node_internal *doctypenode) /* Initialise this document_type */ dom_exception _dom_document_type_initialise(struct dom_document_type *doctype, - struct dom_string *qname, struct dom_string *public_id, - struct dom_string *system_id, dom_alloc alloc, void *pw) + dom_string *qname, dom_string *public_id, + dom_string *system_id, dom_alloc alloc, void *pw) { dom_exception err; @@ -207,7 +207,7 @@ void _dom_document_type_finalise(struct dom_document_type *doctype) * return DOM_NOT_SUPPORTED_ERR. */ dom_exception _dom_document_type_get_name(struct dom_document_type *doc_type, - struct dom_string **result) + dom_string **result) { return dom_node_get_node_name(doc_type, result); } @@ -276,7 +276,7 @@ dom_exception _dom_document_type_get_notations( */ dom_exception _dom_document_type_get_public_id( struct dom_document_type *doc_type, - struct dom_string **result) + dom_string **result) { UNUSED(doc_type); UNUSED(result); @@ -300,7 +300,7 @@ dom_exception _dom_document_type_get_public_id( */ dom_exception _dom_document_type_get_system_id( struct dom_document_type *doc_type, - struct dom_string **result) + dom_string **result) { UNUSED(doc_type); UNUSED(result); @@ -324,7 +324,7 @@ dom_exception _dom_document_type_get_system_id( */ dom_exception _dom_document_type_get_internal_subset( struct dom_document_type *doc_type, - struct dom_string **result) + dom_string **result) { UNUSED(doc_type); UNUSED(result); diff --git a/src/core/document_type.h b/src/core/document_type.h index 4fd1c83..7fcac8e 100644 --- a/src/core/document_type.h +++ b/src/core/document_type.h @@ -12,21 +12,21 @@ struct dom_document_type; struct dom_resource_mgr; /* Create a DOM document type */ -dom_exception _dom_document_type_create(struct dom_string *qname, - struct dom_string *public_id, - struct dom_string *system_id, +dom_exception _dom_document_type_create(dom_string *qname, + dom_string *public_id, + dom_string *system_id, dom_alloc alloc, void *pw, struct dom_document_type **doctype); /* Destroy a document type */ void _dom_document_type_destroy(struct dom_node_internal *doctypenode); dom_exception _dom_document_type_initialise(struct dom_document_type *doctype, - struct dom_string *qname, struct dom_string *public_id, - struct dom_string *system_id, dom_alloc alloc, void *pw); + dom_string *qname, dom_string *public_id, + dom_string *system_id, dom_alloc alloc, void *pw); void _dom_document_type_finalise(struct dom_document_type *doctype); /* The virtual functions of DocumentType */ dom_exception _dom_document_type_get_name(struct dom_document_type *doc_type, - struct dom_string **result); + dom_string **result); dom_exception _dom_document_type_get_entities( struct dom_document_type *doc_type, struct dom_namednodemap **result); @@ -35,13 +35,13 @@ dom_exception _dom_document_type_get_notations( struct dom_namednodemap **result); dom_exception _dom_document_type_get_public_id( struct dom_document_type *doc_type, - struct dom_string **result); + dom_string **result); dom_exception _dom_document_type_get_system_id( struct dom_document_type *doc_type, - struct dom_string **result); + dom_string **result); dom_exception _dom_document_type_get_internal_subset( struct dom_document_type *doc_type, - struct dom_string **result); + dom_string **result); #define DOM_DOCUMENT_TYPE_VTABLE \ _dom_document_type_get_name, \ diff --git a/src/core/element.c b/src/core/element.c index 1069e60..580cb41 100644 --- a/src/core/element.c +++ b/src/core/element.c @@ -50,15 +50,15 @@ static struct dom_element_protected_vtable element_protect_vtable = { }; static dom_exception _dom_element_get_attr(struct dom_element *element, - struct dom_hash_table *hs, struct dom_string *name, - struct dom_string **value); + struct dom_hash_table *hs, dom_string *name, + dom_string **value); static dom_exception _dom_element_set_attr(struct dom_element *element, - struct dom_hash_table *hs, struct dom_string *name, - struct dom_string *value); + struct dom_hash_table *hs, dom_string *name, + dom_string *value); static dom_exception _dom_element_remove_attr(struct dom_element *element, - struct dom_hash_table *hs, struct dom_string *name); + struct dom_hash_table *hs, dom_string *name); static dom_exception _dom_element_get_attr_node(struct dom_element *element, - struct dom_hash_table *hs, struct dom_string *name, + struct dom_hash_table *hs, dom_string *name, struct dom_attr **result); static dom_exception _dom_element_set_attr_node(struct dom_element *element, struct dom_hash_table *hs, struct dom_attr *attr, @@ -67,33 +67,33 @@ static dom_exception _dom_element_remove_attr_node(struct dom_element *element, struct dom_hash_table *hs, struct dom_attr *attr, struct dom_attr **result); static dom_exception _dom_element_has_attr(struct dom_element *element, - struct dom_hash_table *hs, struct dom_string *name, + struct dom_hash_table *hs, dom_string *name, bool *result); static dom_exception _dom_element_set_id_attr(struct dom_element *element, - struct dom_hash_table *hs, struct dom_string *name, bool is_id); + struct dom_hash_table *hs, dom_string *name, bool is_id); /* The operation set for namednodemap */ static dom_exception attributes_get_length(void *priv, unsigned long *length); static dom_exception attributes_get_named_item(void *priv, - struct dom_string *name, struct dom_node **node); + dom_string *name, struct dom_node **node); static dom_exception attributes_set_named_item(void *priv, struct dom_node *arg, struct dom_node **node); static dom_exception attributes_remove_named_item( - void *priv, struct dom_string *name, + void *priv, dom_string *name, struct dom_node **node); static dom_exception attributes_item(void *priv, unsigned long index, struct dom_node **node); static dom_exception attributes_get_named_item_ns( - void *priv, struct dom_string *namespace, - struct dom_string *localname, struct dom_node **node); + void *priv, dom_string *namespace, + dom_string *localname, struct dom_node **node); static dom_exception attributes_set_named_item_ns( void *priv, struct dom_node *arg, struct dom_node **node); static dom_exception attributes_remove_named_item_ns( - void *priv, struct dom_string *namespace, - struct dom_string *localname, struct dom_node **node); + void *priv, dom_string *namespace, + dom_string *localname, struct dom_node **node); static void attributes_destroy(void *priv); static bool attributes_equal(void *p1, void *p2); @@ -273,7 +273,7 @@ void _dom_element_destroy(struct dom_document *doc, * finished with it. */ dom_exception _dom_element_get_tag_name(struct dom_element *element, - struct dom_string **name) + dom_string **name) { /* This is the same as nodeName */ return dom_node_get_node_name((struct dom_node *) element, name); @@ -292,7 +292,7 @@ dom_exception _dom_element_get_tag_name(struct dom_element *element, * finished with it. */ dom_exception _dom_element_get_attribute(struct dom_element *element, - struct dom_string *name, struct dom_string **value) + dom_string *name, dom_string **value) { return _dom_element_get_attr(element, element->attributes, name, value); } @@ -308,7 +308,7 @@ dom_exception _dom_element_get_attribute(struct dom_element *element, * DOM_NO_MODIFICATION_ALLOWED_ERR if ::element is readonly. */ dom_exception _dom_element_set_attribute(struct dom_element *element, - struct dom_string *name, struct dom_string *value) + dom_string *name, dom_string *value) { return _dom_element_set_attr(element, element->attributes, name, value); } @@ -322,7 +322,7 @@ dom_exception _dom_element_set_attribute(struct dom_element *element, * DOM_NO_MODIFICATION_ALLOWED_ERR if ::element is readonly. */ dom_exception _dom_element_remove_attribute(struct dom_element *element, - struct dom_string *name) + dom_string *name) { return _dom_element_remove_attr(element, element->attributes, name); } @@ -340,7 +340,7 @@ dom_exception _dom_element_remove_attribute(struct dom_element *element, * finished with it. */ dom_exception _dom_element_get_attribute_node(struct dom_element *element, - struct dom_string *name, struct dom_attr **result) + dom_string *name, struct dom_attr **result) { return _dom_element_get_attr_node(element, element->attributes, name, result); @@ -406,7 +406,7 @@ dom_exception _dom_element_remove_attribute_node(struct dom_element *element, * finished with it. */ dom_exception _dom_element_get_elements_by_tag_name( - struct dom_element *element, struct dom_string *name, + struct dom_element *element, dom_string *name, struct dom_nodelist **result) { dom_exception err; @@ -445,8 +445,8 @@ dom_exception _dom_element_get_elements_by_tag_name( * finished with it. */ dom_exception _dom_element_get_attribute_ns(struct dom_element *element, - struct dom_string *namespace, struct dom_string *localname, - struct dom_string **value) + dom_string *namespace, dom_string *localname, + dom_string **value) { lwc_string *str; dom_exception err; @@ -500,8 +500,8 @@ dom_exception _dom_element_get_attribute_ns(struct dom_element *element, * Namespaces. */ dom_exception _dom_element_set_attribute_ns(struct dom_element *element, - struct dom_string *namespace, struct dom_string *qname, - struct dom_string *value) + dom_string *namespace, dom_string *qname, + dom_string *value) { lwc_string *str; dom_exception err; @@ -570,7 +570,7 @@ dom_exception _dom_element_set_attribute_ns(struct dom_element *element, * Namespaces. */ dom_exception _dom_element_remove_attribute_ns(struct dom_element *element, - struct dom_string *namespace, struct dom_string *localname) + dom_string *namespace, dom_string *localname) { lwc_string *str; dom_exception err; @@ -611,7 +611,7 @@ dom_exception _dom_element_remove_attribute_ns(struct dom_element *element, * finished with it. */ dom_exception _dom_element_get_attribute_node_ns(struct dom_element *element, - struct dom_string *namespace, struct dom_string *localname, + dom_string *namespace, dom_string *localname, struct dom_attr **result) { lwc_string *str; @@ -725,8 +725,8 @@ dom_exception _dom_element_set_attribute_node_ns(struct dom_element *element, * finished with it. */ dom_exception _dom_element_get_elements_by_tag_name_ns( - struct dom_element *element, struct dom_string *namespace, - struct dom_string *localname, struct dom_nodelist **result) + struct dom_element *element, dom_string *namespace, + dom_string *localname, struct dom_nodelist **result) { dom_document *doc; dom_exception err; @@ -772,7 +772,7 @@ dom_exception _dom_element_get_elements_by_tag_name_ns( * \return DOM_NO_ERR. */ dom_exception _dom_element_has_attribute(struct dom_element *element, - struct dom_string *name, bool *result) + dom_string *name, bool *result) { return _dom_element_has_attr(element, element->attributes, name, result); @@ -793,7 +793,7 @@ dom_exception _dom_element_has_attribute(struct dom_element *element, * Namespaces. */ dom_exception _dom_element_has_attribute_ns(struct dom_element *element, - struct dom_string *namespace, struct dom_string *localname, + dom_string *namespace, dom_string *localname, bool *result) { lwc_string *str; @@ -854,7 +854,7 @@ dom_exception _dom_element_get_schema_type_info(struct dom_element *element, * one such attribute node. */ dom_exception _dom_element_set_id_attribute(struct dom_element *element, - struct dom_string *name, bool is_id) + dom_string *name, bool is_id) { return _dom_element_set_id_attr(element, element->attributes, name, is_id); @@ -873,7 +873,7 @@ dom_exception _dom_element_set_id_attribute(struct dom_element *element, * attribute of ::element. */ dom_exception _dom_element_set_id_attribute_ns(struct dom_element *element, - struct dom_string *namespace, struct dom_string *localname, + dom_string *namespace, dom_string *localname, bool is_id) { struct dom_hash_table *hs; @@ -988,7 +988,7 @@ dom_exception _dom_element_has_attributes(dom_node_internal *node, bool *result) * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_element_lookup_prefix(dom_node_internal *node, - struct dom_string *namespace, struct dom_string **result) + dom_string *namespace, dom_string **result) { struct dom_element *owner; dom_exception err; @@ -1014,7 +1014,7 @@ dom_exception _dom_element_lookup_prefix(dom_node_internal *node, * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_element_is_default_namespace(dom_node_internal *node, - struct dom_string *namespace, bool *result) + dom_string *namespace, bool *result) { struct dom_element *ele = (struct dom_element *) node; lwc_string *ns; @@ -1068,7 +1068,7 @@ dom_exception _dom_element_is_default_namespace(dom_node_internal *node, * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_element_lookup_namespace(dom_node_internal *node, - struct dom_string *prefix, struct dom_string **result) + dom_string *prefix, dom_string **result) { lwc_string *pf; dom_exception err; @@ -1138,8 +1138,8 @@ dom_exception _dom_element_lookup_namespace(dom_node_internal *node, * later easy accessing by any client. */ dom_exception _dom_element_parse_attribute(dom_element *ele, - struct dom_string *name, struct dom_string *value, - struct dom_string **parsed) + dom_string *name, dom_string *value, + dom_string **parsed) { UNUSED(ele); UNUSED(name); @@ -1242,8 +1242,8 @@ dom_exception _dom_element_copy(struct dom_node_internal *new, * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_element_get_attr(struct dom_element *element, - struct dom_hash_table *hs, struct dom_string *name, - struct dom_string **value) + struct dom_hash_table *hs, dom_string *name, + dom_string **value) { void *a; dom_exception err = DOM_NO_ERR; @@ -1276,8 +1276,8 @@ dom_exception _dom_element_get_attr(struct dom_element *element, * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_element_set_attr(struct dom_element *element, - struct dom_hash_table *hs, struct dom_string *name, - struct dom_string *value) + struct dom_hash_table *hs, dom_string *name, + dom_string *value) { void *a; dom_exception err; @@ -1400,7 +1400,7 @@ dom_exception _dom_element_set_attr(struct dom_element *element, * DOM_NO_MODIFICATION_ALLOWED_ERR if ::element is readonly. */ dom_exception _dom_element_remove_attr(struct dom_element *element, - struct dom_hash_table *hs, struct dom_string *name) + struct dom_hash_table *hs, dom_string *name) { void *a; dom_exception err; @@ -1481,7 +1481,7 @@ dom_exception _dom_element_remove_attr(struct dom_element *element, * finished with it. */ dom_exception _dom_element_get_attr_node(struct dom_element *element, - struct dom_hash_table *hs, struct dom_string *name, + struct dom_hash_table *hs, dom_string *name, struct dom_attr **result) { void *a; @@ -1773,7 +1773,7 @@ dom_exception _dom_element_remove_attr_node(struct dom_element *element, * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_element_has_attr(struct dom_element *element, - struct dom_hash_table *hs, struct dom_string *name, + struct dom_hash_table *hs, dom_string *name, bool *result) { void *a; @@ -1807,7 +1807,7 @@ dom_exception _dom_element_has_attr(struct dom_element *element, * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_element_set_id_attr(struct dom_element *element, - struct dom_hash_table *hs, struct dom_string *name, bool is_id) + struct dom_hash_table *hs, dom_string *name, bool is_id) { dom_attr *attr; lwc_string *str; @@ -1971,7 +1971,7 @@ dom_exception attributes_get_length(void *priv, /* Implementation function for NamedNodeMap, see core/namednodemap.h for * details */ dom_exception attributes_get_named_item(void *priv, - struct dom_string *name, struct dom_node **node) + dom_string *name, struct dom_node **node) { dom_element *e = (dom_element *) priv; @@ -1996,7 +1996,7 @@ dom_exception attributes_set_named_item(void *priv, /* Implementation function for NamedNodeMap, see core/namednodemap.h for * details */ dom_exception attributes_remove_named_item( - void *priv, struct dom_string *name, + void *priv, dom_string *name, struct dom_node **node) { dom_element *e = (dom_element *) priv; @@ -2068,8 +2068,8 @@ dom_exception attributes_item(void *priv, /* Implementation function for NamedNodeMap, see core/namednodemap.h for * details */ dom_exception attributes_get_named_item_ns( - void *priv, struct dom_string *namespace, - struct dom_string *localname, struct dom_node **node) + void *priv, dom_string *namespace, + dom_string *localname, struct dom_node **node) { dom_element *e = (dom_element *) priv; @@ -2096,8 +2096,8 @@ dom_exception attributes_set_named_item_ns( /* Implementation function for NamedNodeMap, see core/namednodemap.h for * details */ dom_exception attributes_remove_named_item_ns( - void *priv, struct dom_string *namespace, - struct dom_string *localname, struct dom_node **node) + void *priv, dom_string *namespace, + dom_string *localname, struct dom_node **node) { dom_element *e = (dom_element *) priv; dom_exception err; diff --git a/src/core/element.h b/src/core/element.h index 8a64314..66d1a50 100644 --- a/src/core/element.h +++ b/src/core/element.h @@ -18,7 +18,6 @@ struct dom_document; struct dom_element; struct dom_namednodemap; struct dom_node; -struct dom_string; struct dom_attr; struct dom_type_info; struct dom_hash_table; @@ -57,49 +56,49 @@ void _dom_element_destroy(struct dom_document *doc, /* The virtual functions of dom_element */ dom_exception _dom_element_get_tag_name(struct dom_element *element, - struct dom_string **name); + dom_string **name); dom_exception _dom_element_get_attribute(struct dom_element *element, - struct dom_string *name, struct dom_string **value); + dom_string *name, dom_string **value); dom_exception _dom_element_set_attribute(struct dom_element *element, - struct dom_string *name, struct dom_string *value); + dom_string *name, dom_string *value); dom_exception _dom_element_remove_attribute(struct dom_element *element, - struct dom_string *name); + dom_string *name); dom_exception _dom_element_get_attribute_node(struct dom_element *element, - struct dom_string *name, struct dom_attr **result); + dom_string *name, struct dom_attr **result); dom_exception _dom_element_set_attribute_node(struct dom_element *element, struct dom_attr *attr, struct dom_attr **result); dom_exception _dom_element_remove_attribute_node(struct dom_element *element, struct dom_attr *attr, struct dom_attr **result); dom_exception _dom_element_get_elements_by_tag_name( - struct dom_element *element, struct dom_string *name, + struct dom_element *element, dom_string *name, struct dom_nodelist **result); dom_exception _dom_element_get_attribute_ns(struct dom_element *element, - struct dom_string *namespace, struct dom_string *localname, - struct dom_string **value); + dom_string *namespace, dom_string *localname, + dom_string **value); dom_exception _dom_element_set_attribute_ns(struct dom_element *element, - struct dom_string *namespace, struct dom_string *qname, - struct dom_string *value); + dom_string *namespace, dom_string *qname, + dom_string *value); dom_exception _dom_element_remove_attribute_ns(struct dom_element *element, - struct dom_string *namespace, struct dom_string *localname); + dom_string *namespace, dom_string *localname); dom_exception _dom_element_get_attribute_node_ns(struct dom_element *element, - struct dom_string *namespace, struct dom_string *localname, + dom_string *namespace, dom_string *localname, struct dom_attr **result); dom_exception _dom_element_set_attribute_node_ns(struct dom_element *element, struct dom_attr *attr, struct dom_attr **result); dom_exception _dom_element_get_elements_by_tag_name_ns( - struct dom_element *element, struct dom_string *namespace, - struct dom_string *localname, struct dom_nodelist **result); + struct dom_element *element, dom_string *namespace, + dom_string *localname, struct dom_nodelist **result); dom_exception _dom_element_has_attribute(struct dom_element *element, - struct dom_string *name, bool *result); + dom_string *name, bool *result); dom_exception _dom_element_has_attribute_ns(struct dom_element *element, - struct dom_string *namespace, struct dom_string *localname, + dom_string *namespace, dom_string *localname, bool *result); dom_exception _dom_element_get_schema_type_info(struct dom_element *element, struct dom_type_info **result); dom_exception _dom_element_set_id_attribute(struct dom_element *element, - struct dom_string *name, bool is_id); + dom_string *name, bool is_id); dom_exception _dom_element_set_id_attribute_ns(struct dom_element *element, - struct dom_string *namespace, struct dom_string *localname, + dom_string *namespace, dom_string *localname, bool is_id); dom_exception _dom_element_set_id_attribute_node(struct dom_element *element, struct dom_attr *id_attr, bool is_id); @@ -133,11 +132,11 @@ dom_exception _dom_element_has_attributes(dom_node_internal *node, bool *result); dom_exception _dom_element_normalize(dom_node_internal *node); dom_exception _dom_element_lookup_prefix(dom_node_internal *node, - struct dom_string *namespace, struct dom_string **result); + dom_string *namespace, dom_string **result); dom_exception _dom_element_is_default_namespace(dom_node_internal *node, - struct dom_string *namespace, bool *result); + dom_string *namespace, bool *result); dom_exception _dom_element_lookup_namespace(dom_node_internal *node, - struct dom_string *prefix, struct dom_string **result); + dom_string *prefix, dom_string **result); #define DOM_NODE_VTABLE_ELEMENT \ _dom_node_get_node_name, \ _dom_node_get_node_value, \ @@ -184,8 +183,8 @@ struct dom_element_protected_vtable { struct dom_node_protect_vtable base; dom_exception (*dom_element_parse_attribute)(dom_element *ele, - struct dom_string *name, struct dom_string *value, - struct dom_string **parsed); + dom_string *name, dom_string *value, + dom_string **parsed); /**< Called by dom_attr_set_value, and used to check * whether the new attribute value is valid and * return a valid on if it is not @@ -196,22 +195,22 @@ typedef struct dom_element_protected_vtable dom_element_protected_vtable; /* Parse the attribute's value */ static inline dom_exception dom_element_parse_attribute(dom_element *ele, - struct dom_string *name, struct dom_string *value, - struct dom_string **parsed) + dom_string *name, dom_string *value, + dom_string **parsed) { struct dom_node_internal *node = (struct dom_node_internal *) ele; return ((dom_element_protected_vtable *) node->vtable)-> dom_element_parse_attribute(ele, name, value, parsed); } #define dom_element_parse_attribute(e, n, v, p) dom_element_parse_attribute( \ - (dom_element *) (e), (struct dom_string *) (n), \ - (struct dom_string *) (v), (struct dom_string **) (p)) + (dom_element *) (e), (dom_string *) (n), \ + (dom_string *) (v), (dom_string **) (p)) /* The protected virtual function */ dom_exception _dom_element_parse_attribute(dom_element *ele, - struct dom_string *name, struct dom_string *value, - struct dom_string **parsed); + dom_string *name, dom_string *value, + dom_string **parsed); void __dom_element_destroy(dom_node_internal *node); dom_exception _dom_element_alloc(struct dom_document *doc, struct dom_node_internal *n, struct dom_node_internal **ret); diff --git a/src/core/entity_ref.c b/src/core/entity_ref.c index c5b426c..f35b306 100644 --- a/src/core/entity_ref.c +++ b/src/core/entity_ref.c @@ -43,7 +43,7 @@ static struct dom_node_protect_vtable er_protect_vtable = { * The returned node will already be referenced. */ dom_exception _dom_entity_reference_create(struct dom_document *doc, - struct lwc_string_s *name, struct dom_string *value, + struct lwc_string_s *name, dom_string *value, struct dom_entity_reference **result) { struct dom_entity_reference *e; @@ -101,7 +101,7 @@ void _dom_entity_reference_destroy(struct dom_document *doc, * finished with it. */ dom_exception _dom_entity_reference_get_textual_representation( - struct dom_entity_reference *entity, struct dom_string **result) + struct dom_entity_reference *entity, dom_string **result) { UNUSED(entity); UNUSED(result); diff --git a/src/core/entity_ref.h b/src/core/entity_ref.h index 2b83d07..b83765c 100644 --- a/src/core/entity_ref.h +++ b/src/core/entity_ref.h @@ -13,11 +13,10 @@ struct dom_document; struct dom_entity_reference; -struct dom_string; struct lwc_string_s; dom_exception _dom_entity_reference_create(struct dom_document *doc, - struct lwc_string_s *name, struct dom_string *value, + struct lwc_string_s *name, dom_string *value, struct dom_entity_reference **result); void _dom_entity_reference_destroy(struct dom_document *doc, @@ -41,6 +40,6 @@ dom_exception _dom_er_copy(struct dom_node_internal *new, /* Helper functions */ dom_exception _dom_entity_reference_get_textual_representation( struct dom_entity_reference *entity, - struct dom_string **result); + dom_string **result); #endif diff --git a/src/core/namednodemap.c b/src/core/namednodemap.c index ec1e151..508fbb0 100644 --- a/src/core/namednodemap.c +++ b/src/core/namednodemap.c @@ -134,7 +134,7 @@ dom_exception dom_namednodemap_get_length(struct dom_namednodemap *map, * should unref the node once it has finished with it. */ dom_exception _dom_namednodemap_get_named_item(struct dom_namednodemap *map, - struct dom_string *name, struct dom_node **node) + dom_string *name, struct dom_node **node) { assert(map->opt != NULL); return map->opt->namednodemap_get_named_item(map->priv, name, node); @@ -186,7 +186,7 @@ dom_exception _dom_namednodemap_set_named_item(struct dom_namednodemap *map, * should unref the node once it has finished with it. */ dom_exception _dom_namednodemap_remove_named_item( - struct dom_namednodemap *map, struct dom_string *name, + struct dom_namednodemap *map, dom_string *name, struct dom_node **node) { assert(map->opt != NULL); @@ -231,8 +231,8 @@ dom_exception _dom_namednodemap_item(struct dom_namednodemap *map, * should unref the node once it has finished with it. */ dom_exception _dom_namednodemap_get_named_item_ns( - struct dom_namednodemap *map, struct dom_string *namespace, - struct dom_string *localname, struct dom_node **node) + struct dom_namednodemap *map, dom_string *namespace, + dom_string *localname, struct dom_node **node) { assert(map->opt != NULL); return map->opt->namednodemap_get_named_item_ns(map->priv, namespace, @@ -296,8 +296,8 @@ dom_exception _dom_namednodemap_set_named_item_ns( * should unref the node once it has finished with it. */ dom_exception _dom_namednodemap_remove_named_item_ns( - struct dom_namednodemap *map, struct dom_string *namespace, - struct dom_string *localname, struct dom_node **node) + struct dom_namednodemap *map, dom_string *namespace, + dom_string *localname, struct dom_node **node) { assert(map->opt != NULL); return map->opt->namednodemap_remove_named_item_ns(map->priv, namespace, diff --git a/src/core/namednodemap.h b/src/core/namednodemap.h index 328e433..079294c 100644 --- a/src/core/namednodemap.h +++ b/src/core/namednodemap.h @@ -16,36 +16,35 @@ struct dom_document; struct dom_node; struct dom_namednodemap; -struct dom_string; struct nnm_operation { dom_exception (*namednodemap_get_length)(void *priv, unsigned long *length); dom_exception (*namednodemap_get_named_item)(void *priv, - struct dom_string *name, struct dom_node **node); + dom_string *name, struct dom_node **node); dom_exception (*namednodemap_set_named_item)(void *priv, struct dom_node *arg, struct dom_node **node); dom_exception (*namednodemap_remove_named_item)( - void *priv, struct dom_string *name, + void *priv, dom_string *name, struct dom_node **node); dom_exception (*namednodemap_item)(void *priv, unsigned long index, struct dom_node **node); dom_exception (*namednodemap_get_named_item_ns)( - void *priv, struct dom_string *namespace, - struct dom_string *localname, struct dom_node **node); + void *priv, dom_string *namespace, + dom_string *localname, struct dom_node **node); dom_exception (*namednodemap_set_named_item_ns)( void *priv, struct dom_node *arg, struct dom_node **node); dom_exception (*namednodemap_remove_named_item_ns)( - void *priv, struct dom_string *namespace, - struct dom_string *localname, struct dom_node **node); + void *priv, dom_string *namespace, + dom_string *localname, struct dom_node **node); void (*namednodemap_destroy)(void *priv); diff --git a/src/core/node.c b/src/core/node.c index 71977b4..14dad4a 100644 --- a/src/core/node.c +++ b/src/core/node.c @@ -142,7 +142,7 @@ void _dom_node_destroy(struct dom_node_internal *node) */ dom_exception _dom_node_initialise(dom_node_internal *node, struct dom_document *doc, dom_node_type type, - struct lwc_string_s *name, struct dom_string *value, + struct lwc_string_s *name, dom_string *value, struct lwc_string_s *namespace, struct lwc_string_s *prefix) { dom_alloc alloc; @@ -180,7 +180,7 @@ dom_exception _dom_node_initialise_generic( struct dom_node_internal *node, struct dom_document *doc, dom_alloc alloc, void *pw, dom_node_type type, struct lwc_string_s *name, - struct dom_string *value, struct lwc_string_s *namespace, + dom_string *value, struct lwc_string_s *namespace, struct lwc_string_s *prefix) { UNUSED(alloc); @@ -388,9 +388,9 @@ void _dom_node_unref(dom_node_internal *node) * finished with it. */ dom_exception _dom_node_get_node_name(dom_node_internal *node, - struct dom_string **result) + dom_string **result) { - struct dom_string *node_name, *temp; + dom_string *node_name, *temp; dom_document *doc; dom_exception err; struct dom_resource_mgr rm; @@ -414,7 +414,7 @@ dom_exception _dom_node_get_node_name(dom_node_internal *node, * has a defined prefix, then nodeName is a QName comprised * of prefix:name. */ if(node->prefix != NULL) { - struct dom_string *colon; + dom_string *colon; err = _dom_resource_mgr_create_string(&rm, (const uint8_t *) ":", SLEN(":"), &colon); @@ -491,7 +491,7 @@ dom_exception _dom_node_get_node_name(dom_node_internal *node, * this implementation; dom_strings are unbounded. */ dom_exception _dom_node_get_node_value(dom_node_internal *node, - struct dom_string **result) + dom_string **result) { if (node->value != NULL) dom_string_ref(node->value); @@ -515,7 +515,7 @@ dom_exception _dom_node_get_node_value(dom_node_internal *node, * a reference on the string). The node's existing value will be unrefed. */ dom_exception _dom_node_set_node_value(dom_node_internal *node, - struct dom_string *value) + dom_string *value) { /* TODO * Whether we should change this to a virtual function? @@ -1292,7 +1292,7 @@ dom_exception _dom_node_normalize(dom_node_internal *node) * \return DOM_NO_ERR. */ dom_exception _dom_node_is_supported(dom_node_internal *node, - struct dom_string *feature, struct dom_string *version, + dom_string *feature, dom_string *version, bool *result) { bool has; @@ -1319,7 +1319,7 @@ dom_exception _dom_node_is_supported(dom_node_internal *node, * finished with it. */ dom_exception _dom_node_get_namespace(dom_node_internal *node, - struct dom_string **result) + dom_string **result) { assert(node->owner != NULL); @@ -1343,7 +1343,7 @@ dom_exception _dom_node_get_namespace(dom_node_internal *node, * finished with it. */ dom_exception _dom_node_get_prefix(dom_node_internal *node, - struct dom_string **result) + dom_string **result) { assert(node->owner != NULL); @@ -1380,7 +1380,7 @@ dom_exception _dom_node_get_prefix(dom_node_internal *node, * is "xmlns". */ dom_exception _dom_node_set_prefix(dom_node_internal *node, - struct dom_string *prefix) + dom_string *prefix) { dom_exception err; lwc_string *str; @@ -1436,7 +1436,7 @@ dom_exception _dom_node_set_prefix(dom_node_internal *node, * finished with it. */ dom_exception _dom_node_get_local_name(dom_node_internal *node, - struct dom_string **result) + dom_string **result) { assert(node->owner != NULL); @@ -1486,7 +1486,7 @@ dom_exception _dom_node_has_attributes(dom_node_internal *node, bool *result) * return DOM_NOT_SUPPORTED_ERR. */ dom_exception _dom_node_get_base(dom_node_internal *node, - struct dom_string **result) + dom_string **result) { struct dom_document *doc = node->owner; assert(doc != NULL); @@ -1534,7 +1534,7 @@ dom_exception _dom_node_compare_document_position(dom_node_internal *node, * this implementation; dom_strings are unbounded. */ dom_exception _dom_node_get_text_content(dom_node_internal *node, - struct dom_string **result) + dom_string **result) { dom_node_internal *n; dom_string *str; @@ -1565,7 +1565,7 @@ dom_exception _dom_node_get_text_content(dom_node_internal *node, * Text node containing the new content. */ dom_exception _dom_node_set_text_content(dom_node_internal *node, - struct dom_string *content) + dom_string *content) { dom_node_internal *n, *p, *r; dom_document *doc; @@ -1630,7 +1630,7 @@ dom_exception _dom_node_is_same(dom_node_internal *node, * finished with it. */ dom_exception _dom_node_lookup_prefix(dom_node_internal *node, - struct dom_string *namespace, struct dom_string **result) + dom_string *namespace, dom_string **result) { if (node->parent != NULL) return dom_node_lookup_prefix(node, namespace, result); @@ -1649,7 +1649,7 @@ dom_exception _dom_node_lookup_prefix(dom_node_internal *node, * \return DOM_NO_ERR. */ dom_exception _dom_node_is_default_namespace(dom_node_internal *node, - struct dom_string *namespace, bool *result) + dom_string *namespace, bool *result) { if (node->parent != NULL) return dom_node_is_default_namespace(node, namespace, result); @@ -1671,7 +1671,7 @@ dom_exception _dom_node_is_default_namespace(dom_node_internal *node, * finished with it. */ dom_exception _dom_node_lookup_namespace(dom_node_internal *node, - struct dom_string *prefix, struct dom_string **result) + dom_string *prefix, dom_string **result) { if (node->parent != NULL) return dom_node_lookup_namespace(node->parent, prefix, result); @@ -1786,7 +1786,7 @@ dom_exception _dom_node_is_equal(dom_node_internal *node, * \return DOM_NO_ERR. */ dom_exception _dom_node_get_feature(dom_node_internal *node, - struct dom_string *feature, struct dom_string *version, + dom_string *feature, dom_string *version, void **result) { bool has; @@ -1816,7 +1816,7 @@ dom_exception _dom_node_get_feature(dom_node_internal *node, * \return DOM_NO_ERR. */ dom_exception _dom_node_set_user_data(dom_node_internal *node, - struct dom_string *key, void *data, + dom_string *key, void *data, dom_user_data_handler handler, void **result) { struct dom_user_data *ud = NULL; @@ -1886,7 +1886,7 @@ dom_exception _dom_node_set_user_data(dom_node_internal *node, * \return DOM_NO_ERR. */ dom_exception _dom_node_get_user_data(dom_node_internal *node, - struct dom_string *key, void **result) + dom_string *key, void **result) { struct dom_user_data *ud = NULL; diff --git a/src/core/node.h b/src/core/node.h index 70187d6..3134c49 100644 --- a/src/core/node.h +++ b/src/core/node.h @@ -24,7 +24,7 @@ * User data context attached to a DOM node */ struct dom_user_data { - struct dom_string *key; /**< Key for data */ + dom_string *key; /**< Key for data */ void *data; /**< Client-specific data */ dom_user_data_handler handler; /**< Callback function */ @@ -61,7 +61,7 @@ struct dom_node_internal { struct lwc_string_s *name; /**< Node name (this is the local part * of a QName in the cases where a * namespace exists) */ - struct dom_string *value; /**< Node value */ + dom_string *value; /**< Node value */ dom_node_type type; /**< Node type */ dom_node_internal *parent; /**< Parent node */ dom_node_internal *first_child; /**< First child node */ @@ -87,14 +87,14 @@ dom_node_internal * _dom_node_create(struct dom_document *doc); dom_exception _dom_node_initialise(struct dom_node_internal *node, struct dom_document *doc, dom_node_type type, - struct lwc_string_s *name, struct dom_string *value, + struct lwc_string_s *name, dom_string *value, struct lwc_string_s *namespace, struct lwc_string_s *prefix); dom_exception _dom_node_initialise_generic( struct dom_node_internal *node, struct dom_document *doc, dom_alloc alloc, void *pw, dom_node_type type, struct lwc_string_s *name, - struct dom_string *value, struct lwc_string_s *namespace, + dom_string *value, struct lwc_string_s *namespace, struct lwc_string_s *prefix); void _dom_node_finalise(struct dom_document *doc, dom_node_internal *node); @@ -105,11 +105,11 @@ bool _dom_node_readonly(const dom_node_internal *node); /* The DOM Node's vtable methods */ dom_exception _dom_node_get_node_name(dom_node_internal *node, - struct dom_string **result); + dom_string **result); dom_exception _dom_node_get_node_value(dom_node_internal *node, - struct dom_string **result); + dom_string **result); dom_exception _dom_node_set_node_value(dom_node_internal *node, - struct dom_string *value); + dom_string *value); dom_exception _dom_node_get_node_type(dom_node_internal *node, dom_node_type *result); dom_exception _dom_node_get_parent_node(dom_node_internal *node, @@ -145,43 +145,43 @@ dom_exception _dom_node_clone_node(dom_node_internal *node, bool deep, dom_node_internal **result); dom_exception _dom_node_normalize(dom_node_internal *node); dom_exception _dom_node_is_supported(dom_node_internal *node, - struct dom_string *feature, struct dom_string *version, + dom_string *feature, dom_string *version, bool *result); dom_exception _dom_node_get_namespace(dom_node_internal *node, - struct dom_string **result); + dom_string **result); dom_exception _dom_node_get_prefix(dom_node_internal *node, - struct dom_string **result); + dom_string **result); dom_exception _dom_node_set_prefix(dom_node_internal *node, - struct dom_string *prefix); + dom_string *prefix); dom_exception _dom_node_get_local_name(dom_node_internal *node, - struct dom_string **result); + dom_string **result); dom_exception _dom_node_has_attributes(dom_node_internal *node, bool *result); dom_exception _dom_node_get_base(dom_node_internal *node, - struct dom_string **result); + dom_string **result); dom_exception _dom_node_compare_document_position(dom_node_internal *node, dom_node_internal *other, uint16_t *result); dom_exception _dom_node_get_text_content(dom_node_internal *node, - struct dom_string **result); + dom_string **result); dom_exception _dom_node_set_text_content(dom_node_internal *node, - struct dom_string *content); + dom_string *content); dom_exception _dom_node_is_same(dom_node_internal *node, dom_node_internal *other, bool *result); dom_exception _dom_node_lookup_prefix(dom_node_internal *node, - struct dom_string *namespace, struct dom_string **result); + dom_string *namespace, dom_string **result); dom_exception _dom_node_is_default_namespace(dom_node_internal *node, - struct dom_string *namespace, bool *result); + dom_string *namespace, bool *result); dom_exception _dom_node_lookup_namespace(dom_node_internal *node, - struct dom_string *prefix, struct dom_string **result); + dom_string *prefix, dom_string **result); dom_exception _dom_node_is_equal(dom_node_internal *node, dom_node_internal *other, bool *result); dom_exception _dom_node_get_feature(dom_node_internal *node, - struct dom_string *feature, struct dom_string *version, + dom_string *feature, dom_string *version, void **result); dom_exception _dom_node_set_user_data(dom_node_internal *node, - struct dom_string *key, void *data, + dom_string *key, void *data, dom_user_data_handler handler, void **result); dom_exception _dom_node_get_user_data(dom_node_internal *node, - struct dom_string *key, void **result); + dom_string *key, void **result); #define DOM_NODE_VTABLE \ _dom_node_get_node_name, \ @@ -276,14 +276,14 @@ static inline dom_exception dom_node_copy(struct dom_node_internal *new, #define dom_node_get_refcount(n) ((dom_node_internal *) (n))->refcnt dom_exception _redocument_domstring(struct dom_document *old, - struct dom_document* new, struct dom_string **string); + struct dom_document* new, dom_string **string); dom_exception _dom_merge_adjacent_text(dom_node_internal *p, dom_node_internal *n); /* Used to extract the lwc_string from dom_string. * If there is no lwc_string inside the param, create one use the node->owner * as document */ dom_exception _dom_node_get_intern_string(dom_node_internal *node, - struct dom_string *str, struct lwc_string_s **intern); + dom_string *str, struct lwc_string_s **intern); void _dom_node_unref_intern_string(dom_node_internal *node, struct lwc_string_s *inter); dom_exception _dom_node_create_lwcstring(dom_node_internal *node, diff --git a/src/core/nodelist.h b/src/core/nodelist.h index e467aa6..ba00cbf 100644 --- a/src/core/nodelist.h +++ b/src/core/nodelist.h @@ -15,7 +15,6 @@ struct dom_document; struct dom_node; struct dom_nodelist; -struct dom_string; struct lwc_string_s; /** diff --git a/src/core/pi.c b/src/core/pi.c index 634dc05..1d7a508 100644 --- a/src/core/pi.c +++ b/src/core/pi.c @@ -40,7 +40,7 @@ static struct dom_node_protect_vtable pi_protect_vtable = { * The returned node will already be referenced. */ dom_exception _dom_processing_instruction_create(struct dom_document *doc, - struct lwc_string_s *name, struct dom_string *value, + struct lwc_string_s *name, dom_string *value, struct dom_processing_instruction **result) { struct dom_processing_instruction *p; diff --git a/src/core/pi.h b/src/core/pi.h index 3f6d46c..8eca330 100644 --- a/src/core/pi.h +++ b/src/core/pi.h @@ -12,11 +12,10 @@ struct dom_document; struct dom_processing_instruction; -struct dom_string; struct lwc_string_s; dom_exception _dom_processing_instruction_create(struct dom_document *doc, - struct lwc_string_s *name, struct dom_string *value, + struct lwc_string_s *name, dom_string *value, struct dom_processing_instruction **result); void _dom_processing_instruction_destroy(struct dom_document *doc, diff --git a/src/core/string.c b/src/core/string.c index a443f55..4c104ae 100644 --- a/src/core/string.c +++ b/src/core/string.c @@ -35,7 +35,7 @@ struct dom_string { uint32_t refcnt; /**< Reference count */ }; -static struct dom_string empty_string = { +static dom_string empty_string = { .ptr = NULL, .len = 0, .intern = NULL, @@ -51,7 +51,7 @@ static struct dom_string empty_string = { * * \param str The string to claim a reference on */ -void dom_string_ref(struct dom_string *str) +void dom_string_ref(dom_string *str) { if (str != NULL) str->refcnt++; @@ -65,7 +65,7 @@ void dom_string_ref(struct dom_string *str) * If the reference count reaches zero, any memory claimed by the * string will be released */ -void dom_string_unref(struct dom_string *str) +void dom_string_unref(dom_string *str) { if (str == NULL) return; @@ -98,9 +98,9 @@ void dom_string_unref(struct dom_string *str) * returned DOM string. */ dom_exception dom_string_create(dom_alloc alloc, void *pw, - const uint8_t *ptr, size_t len, struct dom_string **str) + const uint8_t *ptr, size_t len, dom_string **str) { - struct dom_string *ret; + dom_string *ret; if (ptr == NULL || len == 0) { dom_string_ref(&empty_string); @@ -110,7 +110,7 @@ dom_exception dom_string_create(dom_alloc alloc, void *pw, return DOM_NO_ERR; } - ret = alloc(NULL, sizeof(struct dom_string), pw); + ret = alloc(NULL, sizeof(dom_string), pw); if (ret == NULL) return DOM_NO_MEM_ERR; @@ -151,7 +151,7 @@ dom_exception dom_string_create(dom_alloc alloc, void *pw, * real clone, just ref the source string is ok. */ dom_exception dom_string_clone(dom_alloc alloc, void *pw, - struct dom_string *str, struct dom_string **ret) + dom_string *str, dom_string **ret) { if (alloc == str->alloc && pw == str->pw) { *ret = str; @@ -175,7 +175,7 @@ dom_exception dom_string_clone(dom_alloc alloc, void *pw, * \return DOM_NO_ERR on success, DOM_NO_MEM_ERR on memory exhaustion */ dom_exception _dom_string_create_from_lwcstring(dom_alloc alloc, void *pw, - lwc_string *str, struct dom_string **ret) + lwc_string *str, dom_string **ret) { dom_string *r; @@ -184,7 +184,7 @@ dom_exception _dom_string_create_from_lwcstring(dom_alloc alloc, void *pw, return DOM_NO_ERR; } - r = alloc(NULL, sizeof(struct dom_string), pw); + r = alloc(NULL, sizeof(dom_string), pw); if (r == NULL) return DOM_NO_MEM_ERR; @@ -218,7 +218,7 @@ dom_exception _dom_string_create_from_lwcstring(dom_alloc alloc, void *pw, * \param lwcstr The result lwc_string * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ -dom_exception _dom_string_intern(struct dom_string *str, +dom_exception _dom_string_intern(dom_string *str, struct lwc_string_s **lwcstr) { lwc_string *ret; @@ -254,7 +254,7 @@ dom_exception _dom_string_intern(struct dom_string *str, * \param lwcstr The lwc_string of this dom-string * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ -dom_exception dom_string_get_intern(struct dom_string *str, +dom_exception dom_string_get_intern(dom_string *str, struct lwc_string_s **lwcstr) { *lwcstr = str->intern; @@ -274,7 +274,7 @@ dom_exception dom_string_get_intern(struct dom_string *str, * * NULL and "" will match. */ -int dom_string_cmp(struct dom_string *s1, struct dom_string *s2) +int dom_string_cmp(dom_string *s1, dom_string *s2) { bool ret; @@ -308,7 +308,7 @@ int dom_string_cmp(struct dom_string *s1, struct dom_string *s2) * * NULL and "" will match. */ -int dom_string_icmp(struct dom_string *s1, struct dom_string *s2) +int dom_string_icmp(dom_string *s1, dom_string *s2) { const uint8_t *d1 = NULL; const uint8_t *d2 = NULL; @@ -369,7 +369,7 @@ int dom_string_icmp(struct dom_string *s1, struct dom_string *s2) * \param chr UCS4 value to look for * \return Character index of found character, or -1 if none found */ -uint32_t dom_string_index(struct dom_string *str, uint32_t chr) +uint32_t dom_string_index(dom_string *str, uint32_t chr) { const uint8_t *s; size_t clen, slen; @@ -409,7 +409,7 @@ uint32_t dom_string_index(struct dom_string *str, uint32_t chr) * \param chr UCS4 value to look for * \return Character index of found character, or -1 if none found */ -uint32_t dom_string_rindex(struct dom_string *str, uint32_t chr) +uint32_t dom_string_rindex(dom_string *str, uint32_t chr) { const uint8_t *s; size_t clen, slen; @@ -453,7 +453,7 @@ uint32_t dom_string_rindex(struct dom_string *str, uint32_t chr) * \param str The string to measure the length of * \return The length of the string, in characters */ -uint32_t dom_string_length(struct dom_string *str) +uint32_t dom_string_length(dom_string *str) { size_t clen; parserutils_error err; @@ -476,7 +476,7 @@ uint32_t dom_string_length(struct dom_string *str) * \param ch The UCS4 character * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ -dom_exception dom_string_at(struct dom_string *str, uint32_t index, +dom_exception dom_string_at(dom_string *str, uint32_t index, uint32_t *ch) { const uint8_t *s; @@ -533,10 +533,10 @@ dom_exception dom_string_at(struct dom_string *str, uint32_t index, * The returned string will have its reference count increased. The client * should dereference it once it has finished with it. */ -dom_exception dom_string_concat(struct dom_string *s1, struct dom_string *s2, - struct dom_string **result) +dom_exception dom_string_concat(dom_string *s1, dom_string *s2, + dom_string **result) { - struct dom_string *concat; + dom_string *concat; dom_alloc alloc; void *pw; @@ -555,7 +555,7 @@ dom_exception dom_string_concat(struct dom_string *s1, struct dom_string *s2, return DOM_NO_ERR; } - concat = alloc(NULL, sizeof(struct dom_string), pw); + concat = alloc(NULL, sizeof(dom_string), pw); if (concat == NULL) { return DOM_NO_MEM_ERR; @@ -600,8 +600,8 @@ dom_exception dom_string_concat(struct dom_string *s1, struct dom_string *s2, * The returned string will have its reference count increased. The client * should dereference it once it has finished with it. */ -dom_exception dom_string_substr(struct dom_string *str, - uint32_t i1, uint32_t i2, struct dom_string **result) +dom_exception dom_string_substr(dom_string *str, + uint32_t i1, uint32_t i2, dom_string **result) { const uint8_t *s = str->ptr; size_t slen = str->len; @@ -657,11 +657,11 @@ dom_exception dom_string_substr(struct dom_string *str, * The returned string will have its reference count increased. The client * should dereference it once it has finished with it. */ -dom_exception dom_string_insert(struct dom_string *target, - struct dom_string *source, uint32_t offset, - struct dom_string **result) +dom_exception dom_string_insert(dom_string *target, + dom_string *source, uint32_t offset, + dom_string **result) { - struct dom_string *res; + dom_string *res; const uint8_t *t, *s; uint32_t tlen, slen, clen; uint32_t ins = 0; @@ -696,7 +696,7 @@ dom_exception dom_string_insert(struct dom_string *target, } /* Allocate result string */ - res = target->alloc(NULL, sizeof(struct dom_string), target->pw); + res = target->alloc(NULL, sizeof(dom_string), target->pw); if (res == NULL) { return DOM_NO_MEM_ERR; } @@ -750,11 +750,11 @@ dom_exception dom_string_insert(struct dom_string *target, * The returned string will have its reference count increased. The client * should dereference it once it has finished with it. */ -dom_exception dom_string_replace(struct dom_string *target, - struct dom_string *source, uint32_t i1, uint32_t i2, - struct dom_string **result) +dom_exception dom_string_replace(dom_string *target, + dom_string *source, uint32_t i1, uint32_t i2, + dom_string **result) { - struct dom_string *res; + dom_string *res; const uint8_t *t, *s; uint32_t tlen, slen; uint32_t b1, b2; @@ -799,7 +799,7 @@ dom_exception dom_string_replace(struct dom_string *target, } /* Allocate result string */ - res = target->alloc(NULL, sizeof(struct dom_string), target->pw); + res = target->alloc(NULL, sizeof(dom_string), target->pw); if (res == NULL) { return DOM_NO_MEM_ERR; @@ -853,8 +853,8 @@ dom_exception dom_string_replace(struct dom_string *target, * The returned string will have its reference count increased. The client * should dereference it once it has finished with it. */ -dom_exception dom_string_dup(struct dom_string *str, - struct dom_string **result) +dom_exception dom_string_dup(dom_string *str, + dom_string **result) { if (str->intern != NULL) { return _dom_string_create_from_lwcstring(str->alloc, str->pw, @@ -871,7 +871,7 @@ dom_exception dom_string_dup(struct dom_string *str, * \param str The string to calculate a hash of * \return The hash value associated with the string */ -uint32_t dom_string_hash(struct dom_string *str) +uint32_t dom_string_hash(dom_string *str) { const uint8_t *s = str->ptr; size_t slen = str->len; @@ -918,7 +918,7 @@ dom_exception _dom_exception_from_lwc_error(lwc_error err) * @note: This function is just provided for the convenience of accessing the * raw C string character, no change on the result string is allowed. */ -char *_dom_string_data(struct dom_string *str) +char *_dom_string_data(dom_string *str) { return (char *) str->ptr; } @@ -927,7 +927,7 @@ char *_dom_string_data(struct dom_string *str) * * \param str The dom_string object */ -size_t _dom_string_length(struct dom_string *str) +size_t _dom_string_length(dom_string *str) { return str->len; } diff --git a/src/core/string.h b/src/core/string.h index ef231be..d5a943a 100644 --- a/src/core/string.h +++ b/src/core/string.h @@ -13,10 +13,10 @@ /* Create a DOM string from a lwc_string * This function call mainly used for create a string from lwc_string */ dom_exception _dom_string_create_from_lwcstring(dom_alloc alloc, void *pw, - struct lwc_string_s *str, struct dom_string **ret); + struct lwc_string_s *str, dom_string **ret); /* Make the dom_string be interned */ -dom_exception _dom_string_intern(struct dom_string *str, +dom_exception _dom_string_intern(dom_string *str, struct lwc_string_s **lwcstr); /* Map the lwc_error to dom_exception */ @@ -27,10 +27,10 @@ dom_exception _dom_exception_from_lwc_error(lwc_error err); * @note: This function is just provided for the convenience of accessing the * raw C string character, no change on the result string is allowed. */ -char *_dom_string_data(struct dom_string *str); +char *_dom_string_data(dom_string *str); /* Get the string length of this dom_string */ -size_t _dom_string_length(struct dom_string *str); +size_t _dom_string_length(dom_string *str); #endif diff --git a/src/core/text.c b/src/core/text.c index 6aa6d0f..1cb8981 100644 --- a/src/core/text.c +++ b/src/core/text.c @@ -69,7 +69,7 @@ static dom_exception walk_logic_adjacent_text(dom_text *text, * The returned node will already be referenced. */ dom_exception _dom_text_create(struct dom_document *doc, - struct lwc_string_s *name, struct dom_string *value, + struct lwc_string_s *name, dom_string *value, struct dom_text **result) { struct dom_text *t; @@ -127,7 +127,7 @@ void _dom_text_destroy(struct dom_document *doc, struct dom_text *text) */ dom_exception _dom_text_initialise(struct dom_text *text, struct dom_document *doc, dom_node_type type, - struct lwc_string_s *name, struct dom_string *value) + struct lwc_string_s *name, dom_string *value) { dom_exception err; @@ -177,7 +177,7 @@ dom_exception _dom_text_split_text(struct dom_text *text, unsigned long offset, struct dom_text **result) { struct dom_node_internal *t = (struct dom_node_internal *) text; - struct dom_string *value; + dom_string *value; struct dom_text *res; unsigned long len; dom_exception err; @@ -248,7 +248,7 @@ dom_exception _dom_text_get_is_element_content_whitespace( * \return DOM_NO_ERR. */ dom_exception _dom_text_get_whole_text(struct dom_text *text, - struct dom_string **result) + dom_string **result) { return walk_logic_adjacent_text(text, COLLECT, result); } @@ -267,7 +267,7 @@ dom_exception _dom_text_get_whole_text(struct dom_text *text, * once it has finished with it. */ dom_exception _dom_text_replace_whole_text(struct dom_text *text, - struct dom_string *content, struct dom_text **result) + dom_string *content, struct dom_text **result) { dom_exception err; dom_string *ret; diff --git a/src/core/text.h b/src/core/text.h index 44e09e7..c1d0956 100644 --- a/src/core/text.h +++ b/src/core/text.h @@ -15,7 +15,6 @@ #include "core/characterdata.h" struct dom_document; -struct dom_string; struct lwc_string_s; /** @@ -30,14 +29,14 @@ struct dom_text { /* Constructor and Destructor */ dom_exception _dom_text_create(struct dom_document *doc, - struct lwc_string_s *name, struct dom_string *value, + struct lwc_string_s *name, dom_string *value, struct dom_text **result); void _dom_text_destroy(struct dom_document *doc, struct dom_text *text); dom_exception _dom_text_initialise(struct dom_text *text, struct dom_document *doc, dom_node_type type, - struct lwc_string_s *name, struct dom_string *value); + struct lwc_string_s *name, dom_string *value); void _dom_text_finalise(struct dom_document *doc, struct dom_text *text); @@ -48,9 +47,9 @@ dom_exception _dom_text_split_text(struct dom_text *text, dom_exception _dom_text_get_is_element_content_whitespace( struct dom_text *text, bool *result); dom_exception _dom_text_get_whole_text(struct dom_text *text, - struct dom_string **result); + dom_string **result); dom_exception _dom_text_replace_whole_text(struct dom_text *text, - struct dom_string *content, struct dom_text **result); + dom_string *content, struct dom_text **result); #define DOM_TEXT_VTABLE \ _dom_text_split_text, \ diff --git a/src/core/typeinfo.c b/src/core/typeinfo.c index 4ebefcd..c0ca342 100644 --- a/src/core/typeinfo.c +++ b/src/core/typeinfo.c @@ -27,7 +27,7 @@ struct dom_type_info { * return DOM_NOT_SUPPORTED_ERR. */ dom_exception _dom_type_info_get_type_name(dom_type_info *ti, - struct dom_string **ret) + dom_string **ret) { UNUSED(ti); UNUSED(ret); @@ -46,7 +46,7 @@ dom_exception _dom_type_info_get_type_name(dom_type_info *ti, * return DOM_NOT_SUPPORTED_ERR. */ dom_exception _dom_type_info_get_type_namespace(dom_type_info *ti, - struct dom_string **ret) + dom_string **ret) { UNUSED(ti); UNUSED(ret); @@ -67,7 +67,7 @@ dom_exception _dom_type_info_get_type_namespace(dom_type_info *ti, * return DOM_NOT_SUPPORTED_ERR. */ dom_exception _dom_type_info_is_derived(dom_type_info *ti, - struct dom_string *namespace, struct dom_string *name, + dom_string *namespace, dom_string *name, dom_type_info_derivation_method method, bool *ret) { UNUSED(ti); |