From eff8ce4550d19259d62e6170d294cea1640c786d Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Mon, 11 Aug 2008 12:01:19 +0000 Subject: Only create the namespace URIs once svn path=/trunk/netsurf/; revision=5024 --- render/html.c | 9 +++------ render/html.h | 1 - 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/render/html.c b/render/html.c index 5dc505e02..dd34883df 100644 --- a/render/html.c +++ b/render/html.c @@ -113,6 +113,7 @@ const char const *ns_urls[NUM_NAMESPACES] = { "http://www.w3.org/2000/xmlns/" }; +static bool had_ns; xmlNs *ns_ns[NUM_NAMESPACES]; static int create_comment(void *ctx, const hubbub_string *data, void **result); @@ -186,9 +187,6 @@ int create_doctype(void *ctx, const hubbub_doctype *doctype, void **result) int create_element(void *ctx, const hubbub_tag *tag, void **result) { - struct content *c = ctx; - struct content_html_data *html = &c->data.html; - char *name = strndup((const char *) tag->name.ptr, tag->name.len); @@ -196,13 +194,13 @@ int create_element(void *ctx, const hubbub_tag *tag, void **result) node->_private = (void *)1; *result = node; - if (html->firstelem == true) { + if (had_ns == false) { for (size_t i = 1; i < NUM_NAMESPACES; i++) { ns_ns[i] = xmlNewNs(node, BAD_CAST ns_urls[i], BAD_CAST ns_prefixes[i]); } - html->firstelem = false; + had_ns = true; } xmlSetNs(node, ns_ns[tag->ns]); @@ -486,7 +484,6 @@ bool html_create(struct content *c, const char *params[]) html->parser = 0; #ifdef WITH_HUBBUB html->document = 0; - html->firstelem = true; #endif html->encoding_handler = 0; html->encoding = 0; diff --git a/render/html.h b/render/html.h index 29691ea26..14afa10b7 100644 --- a/render/html.h +++ b/render/html.h @@ -124,7 +124,6 @@ struct content_html_data { hubbub_parser *parser; /**< HTML parser context. */ hubbub_tree_handler tree_handler; xmlDoc *document; - bool firstelem; #endif /** HTML parser encoding handler. */ -- cgit v1.2.3