summaryrefslogtreecommitdiff
path: root/bindings/hubbub
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2010-12-06 23:15:39 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2010-12-06 23:15:39 +0000
commit75d7ce5895a98026a3e4b0e03fafc0b3761a07f1 (patch)
treeaeb5cac1db5f7717d69a48eaaebb2489f6395d6f /bindings/hubbub
parentc8534543c994eb03ecae71064dae88cc320f2e09 (diff)
downloadlibdom-75d7ce5895a98026a3e4b0e03fafc0b3761a07f1.tar.gz
libdom-75d7ce5895a98026a3e4b0e03fafc0b3761a07f1.tar.bz2
Simplify DOMImplementation API by replacing dom_strings with const char *
svn path=/trunk/libdom/; revision=11024
Diffstat (limited to 'bindings/hubbub')
-rw-r--r--bindings/hubbub/parser.c34
1 files changed, 15 insertions, 19 deletions
diff --git a/bindings/hubbub/parser.c b/bindings/hubbub/parser.c
index 5566662..97d3e24 100644
--- a/bindings/hubbub/parser.c
+++ b/bindings/hubbub/parser.c
@@ -316,42 +316,38 @@ static hubbub_error create_doctype(void *parser, const hubbub_doctype *doctype,
{
dom_hubbub_parser *dom_parser = (dom_hubbub_parser *) parser;
dom_exception err;
- struct dom_string *qname, *public_id = NULL, *system_id = NULL;
+ char *qname, *public_id = NULL, *system_id = NULL;
struct dom_document_type *dtype;
*result = NULL;
- err = dom_string_create(dom_parser->alloc, dom_parser->pw,
- doctype->name.ptr, doctype->name.len, &qname);
- if (err != DOM_NO_ERR) {
+ qname = strndup((const char *) doctype->name.ptr,
+ (size_t) doctype->name.len);
+ if (qname == NULL) {
dom_parser->msg(DOM_MSG_CRITICAL, dom_parser->mctx,
"Can't create doctype name");
goto fail;
}
if (doctype->public_missing == false) {
- err = dom_string_create(dom_parser->alloc, dom_parser->pw,
- doctype->public_id.ptr,
- doctype->public_id.len, &public_id);
+ public_id = strndup((const char *) doctype->public_id.ptr,
+ (size_t) doctype->public_id.len);
} else {
- err = dom_string_create(dom_parser->alloc, dom_parser->pw,
- NULL, 0, &public_id);
+ public_id = strdup("");
}
- if (err != DOM_NO_ERR) {
+ if (public_id == NULL) {
dom_parser->msg(DOM_MSG_CRITICAL, dom_parser->mctx,
"Can't create doctype public id");
goto clean1;
}
if (doctype->system_missing == false) {
- err = dom_string_create(dom_parser->alloc, dom_parser->pw,
- doctype->system_id.ptr,
- doctype->system_id.len, &system_id);
+ system_id = strndup((const char *) doctype->system_id.ptr,
+ (size_t) doctype->system_id.len);
} else {
- err = dom_string_create(dom_parser->alloc, dom_parser->pw,
- NULL, 0, &system_id);
+ system_id = strdup("");
}
- if (err != DOM_NO_ERR) {
+ if (system_id == NULL) {
dom_parser->msg(DOM_MSG_CRITICAL, dom_parser->mctx,
"Can't create doctype system id");
goto clean2;
@@ -369,13 +365,13 @@ static hubbub_error create_doctype(void *parser, const hubbub_doctype *doctype,
*result = dtype;
clean3:
- dom_string_unref(system_id);
+ free(system_id);
clean2:
- dom_string_unref(public_id);
+ free(public_id);
clean1:
- dom_string_unref(qname);
+ free(qname);
fail:
if (*result == NULL)