summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2012-07-22 18:58:22 +0100
committerMichael Drake <tlsa@netsurf-browser.org>2012-07-22 18:58:22 +0100
commit1947019095d77c01d0b0f6ca381bb936d6258524 (patch)
tree7ee00fe3743db4a0ea22a27b14de5609a9fc7fbd
parent9de20d9a1a9281ddf3b1d42f99f8e85c5c990af0 (diff)
downloadnetsurf-1947019095d77c01d0b0f6ca381bb936d6258524.tar.gz
netsurf-1947019095d77c01d0b0f6ca381bb936d6258524.tar.bz2
Interned string cleanup, phase 4: Move html_script.c to corestring.
-rw-r--r--render/html_script.c19
-rw-r--r--utils/corestrings.c6
-rw-r--r--utils/corestrings.h2
3 files changed, 20 insertions, 7 deletions
diff --git a/render/html_script.c b/render/html_script.c
index 631dcca1e..5fd8c8acc 100644
--- a/render/html_script.c
+++ b/render/html_script.c
@@ -29,6 +29,7 @@
#include <stdlib.h>
#include "utils/config.h"
+#include "utils/corestrings.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "javascript/js.h"
@@ -77,19 +78,23 @@ static bool html_scripts_exec(html_content *c)
continue;
/* ensure script content fetch status is not an error */
- if (content_get_status(s->data.external) == CONTENT_STATUS_ERROR)
+ if (content_get_status(s->data.external) ==
+ CONTENT_STATUS_ERROR)
continue;
/* ensure script handler for content type */
- script_handler = select_script_handler(content_get_type(s->data.external));
+ script_handler = select_script_handler(
+ content_get_type(s->data.external));
if (script_handler == NULL)
continue; /* unsupported type */
- if (content_get_status(s->data.external) == CONTENT_STATUS_DONE) {
+ if (content_get_status(s->data.external) ==
+ CONTENT_STATUS_DONE) {
/* external script is now available */
const char *data;
unsigned long size;
- data = content_get_source_data(s->data.external, &size );
+ data = content_get_source_data(
+ s->data.external, &size );
script_handler(c->jscontext, data, size);
s->already_started = true;
@@ -236,12 +241,12 @@ html_process_script(void *ctx, dom_node *node)
LOG(("content %p parser %p node %p",c,c->parser, node));
- exc = dom_element_get_attribute(node, html_dom_string_type, &mimetype);
+ exc = dom_element_get_attribute(node, corestring_dom_type, &mimetype);
if (exc != DOM_NO_ERR || mimetype == NULL) {
- mimetype = dom_string_ref(html_dom_string_text_javascript);
+ mimetype = dom_string_ref(corestring_dom_text_javascript);
}
- exc = dom_element_get_attribute(node, html_dom_string_src, &src);
+ exc = dom_element_get_attribute(node, corestring_dom_src, &src);
if (exc != DOM_NO_ERR || src == NULL) {
struct lwc_string_s *lwcmimetype;
script_handler_t *script_handler;
diff --git a/utils/corestrings.c b/utils/corestrings.c
index 9cfe1eaf2..d56d9a1f7 100644
--- a/utils/corestrings.c
+++ b/utils/corestrings.c
@@ -85,7 +85,9 @@ dom_string *corestring_dom_hspace;
dom_string *corestring_dom_link;
dom_string *corestring_dom_rows;
dom_string *corestring_dom_size;
+dom_string *corestring_dom_src;
dom_string *corestring_dom_text;
+dom_string *corestring_dom_text_javascript;
dom_string *corestring_dom_type;
dom_string *corestring_dom_valign;
dom_string *corestring_dom_vlink;
@@ -174,7 +176,9 @@ void corestrings_fini(void)
CSS_DOM_STRING_UNREF(link);
CSS_DOM_STRING_UNREF(rows);
CSS_DOM_STRING_UNREF(size);
+ CSS_DOM_STRING_UNREF(src);
CSS_DOM_STRING_UNREF(text);
+ CSS_DOM_STRING_UNREF(text_javascript);
CSS_DOM_STRING_UNREF(type);
CSS_DOM_STRING_UNREF(valign);
CSS_DOM_STRING_UNREF(vlink);
@@ -279,7 +283,9 @@ nserror corestrings_init(void)
CSS_DOM_STRING_INTERN(link);
CSS_DOM_STRING_INTERN(rows);
CSS_DOM_STRING_INTERN(size);
+ CSS_DOM_STRING_INTERN(src);
CSS_DOM_STRING_INTERN(text);
+ CSS_DOM_STRING_INTERN(text_javascript);
CSS_DOM_STRING_INTERN(type);
CSS_DOM_STRING_INTERN(valign);
CSS_DOM_STRING_INTERN(vlink);
diff --git a/utils/corestrings.h b/utils/corestrings.h
index 52acf1da1..008b6a042 100644
--- a/utils/corestrings.h
+++ b/utils/corestrings.h
@@ -92,7 +92,9 @@ extern struct dom_string *corestring_dom_hspace;
extern struct dom_string *corestring_dom_link;
extern struct dom_string *corestring_dom_rows;
extern struct dom_string *corestring_dom_size;
+extern struct dom_string *corestring_dom_src;
extern struct dom_string *corestring_dom_text;
+extern struct dom_string *corestring_dom_text_javascript;
extern struct dom_string *corestring_dom_type;
extern struct dom_string *corestring_dom_valign;
extern struct dom_string *corestring_dom_vlink;