From 1947019095d77c01d0b0f6ca381bb936d6258524 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sun, 22 Jul 2012 18:58:22 +0100 Subject: Interned string cleanup, phase 4: Move html_script.c to corestring. --- render/html_script.c | 19 ++++++++++++------- utils/corestrings.c | 6 ++++++ utils/corestrings.h | 2 ++ 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 #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; -- cgit v1.2.3