From ac42344d05ec326f0063133498ec1c040e924db2 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Sun, 5 Dec 2010 23:52:56 +0000 Subject: Remove bootstrap infrastructure, and just make dom_implementation a stub. We only support a single implementation, so all the registry and implementation list stuff is totally unnecesary and overcomplex svn path=/trunk/dom/; revision=11017 --- bindings/hubbub/parser.c | 33 ++------------------------------- bindings/xml/xmlparser.c | 36 ++---------------------------------- 2 files changed, 4 insertions(+), 65 deletions(-) (limited to 'bindings') diff --git a/bindings/hubbub/parser.c b/bindings/hubbub/parser.c index c7fc608..5566662 100644 --- a/bindings/hubbub/parser.c +++ b/bindings/hubbub/parser.c @@ -38,8 +38,6 @@ struct dom_hubbub_parser { bool complete; /**< Indicate stream completion */ - struct dom_implementation *impl;/**< DOM implementation */ - dom_alloc alloc; /**< Memory (de)allocation function */ void *pw; /**< Pointer to client data */ @@ -118,7 +116,6 @@ dom_hubbub_parser *dom_hubbub_parser_create( hubbub_parser_optparams params; hubbub_error error; dom_exception err; - struct dom_string *features; parser = alloc(NULL, sizeof(dom_hubbub_parser), pw); if (parser == NULL) { @@ -132,7 +129,6 @@ dom_hubbub_parser *dom_hubbub_parser_create( parser->encoding_source = enc != NULL ? ENCODING_SOURCE_HEADER : ENCODING_SOURCE_DETECTED; parser->complete = false; - parser->impl = NULL; parser->alloc = alloc; parser->pw = pw; @@ -146,34 +142,10 @@ dom_hubbub_parser *dom_hubbub_parser_create( return NULL; } - /* Create string representation of the features we want */ - err = dom_string_create(alloc, pw, - (const uint8_t *) "HTML", SLEN("HTML"), &features); - if (err != DOM_NO_ERR) { - hubbub_parser_destroy(parser->parser); - alloc(parser, 0, pw); - msg(DOM_MSG_CRITICAL, mctx, "No memory for feature string"); - return NULL; - } - - /* Now, try to get an appropriate implementation from the registry */ - err = dom_implregistry_get_dom_implementation(features, - &parser->impl); - if (err != DOM_NO_ERR) { - dom_string_unref(features); - hubbub_parser_destroy(parser->parser); - alloc(parser, 0, pw); - msg(DOM_MSG_ERROR, mctx, "No suitable DOMImplementation"); - return NULL; - } - - /* No longer need the feature string */ - dom_string_unref(features); - /* TODO: Just pass the dom_events_default_action_fetcher a NULL, * we should pass the real function when we integrate libDOM with * Netsurf */ - err = dom_implementation_create_document(parser->impl, NULL, NULL, NULL, + err = dom_implementation_create_document(NULL, NULL, NULL, alloc, pw, NULL, &parser->doc); if (err != DOM_NO_ERR) { hubbub_parser_destroy(parser->parser); @@ -204,7 +176,6 @@ dom_hubbub_parser *dom_hubbub_parser_create( */ void dom_hubbub_parser_destroy(dom_hubbub_parser *parser) { - dom_implementation_unref(parser->impl); hubbub_parser_destroy(parser->parser); parser->parser = NULL; @@ -386,7 +357,7 @@ static hubbub_error create_doctype(void *parser, const hubbub_doctype *doctype, goto clean2; } - err = dom_implementation_create_document_type(dom_parser->impl, qname, + err = dom_implementation_create_document_type(qname, public_id, system_id, dom_parser->alloc, dom_parser->pw, &dtype); if (err != DOM_NO_ERR) { diff --git a/bindings/xml/xmlparser.c b/bindings/xml/xmlparser.c index 8e1013f..f8b3cb9 100644 --- a/bindings/xml/xmlparser.c +++ b/bindings/xml/xmlparser.c @@ -13,7 +13,6 @@ #include #include -#include #include #include @@ -97,8 +96,6 @@ struct dom_xml_parser { struct dom_string *udkey; /**< Key for DOM node user data */ - struct dom_implementation *impl;/**< DOM implementation */ - dom_alloc alloc; /**< Memory (de)allocation function */ void *pw; /**< Pointer to client data */ @@ -163,7 +160,6 @@ dom_xml_parser *dom_xml_parser_create(const char *enc, const char *int_enc, dom_alloc alloc, void *pw, dom_msg msg, void *mctx) { dom_xml_parser *parser; - struct dom_string *features; dom_exception err; int ret; @@ -204,32 +200,6 @@ dom_xml_parser *dom_xml_parser_create(const char *enc, const char *int_enc, return NULL; } - /* Create a string representation of the features we want */ - err = dom_string_create((dom_alloc) alloc, pw, - (const uint8_t *) "XML", SLEN("XML"), &features); - if (err != DOM_NO_ERR) { - dom_string_unref(parser->udkey); - xmlFreeParserCtxt(parser->xml_ctx); - alloc(parser, 0, pw); - msg(DOM_MSG_CRITICAL, mctx, "No memory for feature string"); - return NULL; - } - - /* Now, try to get an appropriate implementation from the registry */ - err = dom_implregistry_get_dom_implementation(features, - &parser->impl); - if (err != DOM_NO_ERR) { - dom_string_unref(features); - dom_string_unref(parser->udkey); - xmlFreeParserCtxt(parser->xml_ctx); - alloc(parser, 0, pw); - msg(DOM_MSG_ERROR, mctx, "No suitable DOMImplementation"); - return NULL; - } - - /* No longer need the feature string */ - dom_string_unref(features); - parser->alloc = alloc; parser->pw = pw; @@ -246,8 +216,6 @@ dom_xml_parser *dom_xml_parser_create(const char *enc, const char *int_enc, */ void dom_xml_parser_destroy(dom_xml_parser *parser) { - dom_implementation_unref(parser->impl); - dom_string_unref(parser->udkey); xmlFreeParserCtxt(parser->xml_ctx); @@ -346,7 +314,7 @@ void xml_parser_start_document(void *ctx) /* TODO: Just pass the dom_events_default_action_fetcher a NULL, * we should pass the real function when we integrate libDOM with * Netsurf */ - err = dom_implementation_create_document(parser->impl, + err = dom_implementation_create_document( /* namespace */ NULL, /* qname */ NULL, /* doctype */ NULL, @@ -1235,7 +1203,7 @@ void xml_parser_add_document_type(dom_xml_parser *parser, } /* Create doctype */ - err = dom_implementation_create_document_type(parser->impl, + err = dom_implementation_create_document_type( qname, public_id, system_id, parser->alloc, parser->pw, &doctype); if (err != DOM_NO_ERR) { -- cgit v1.2.3