summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2008-08-11 12:01:19 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2008-08-11 12:01:19 +0000
commiteff8ce4550d19259d62e6170d294cea1640c786d (patch)
tree6a79f2c0d7683858923141d5014a583b17091f4e /render
parent00a1a0d35ca986d2ee60edf4d93f2bd4f670d6b5 (diff)
downloadnetsurf-eff8ce4550d19259d62e6170d294cea1640c786d.tar.gz
netsurf-eff8ce4550d19259d62e6170d294cea1640c786d.tar.bz2
Only create the namespace URIs once
svn path=/trunk/netsurf/; revision=5024
Diffstat (limited to 'render')
-rw-r--r--render/html.c9
-rw-r--r--render/html.h1
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. */