summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
Diffstat (limited to 'render')
-rw-r--r--render/html.c24
-rw-r--r--render/textplain.c23
2 files changed, 15 insertions, 32 deletions
diff --git a/render/html.c b/render/html.c
index 13f8d84b5..5378480c5 100644
--- a/render/html.c
+++ b/render/html.c
@@ -145,7 +145,6 @@ static const char *html_types[] = {
"text/html"
};
-static lwc_string *html_mime_types[NOF_ELEMENTS(html_types)];
static lwc_string *html_charset;
nserror html_init(void)
@@ -160,16 +159,8 @@ nserror html_init(void)
goto error;
}
- for (i = 0; i < NOF_ELEMENTS(html_mime_types); i++) {
- lerror = lwc_intern_string(html_types[i],
- strlen(html_types[i]),
- &html_mime_types[i]);
- if (lerror != lwc_error_ok) {
- error = NSERROR_NOMEM;
- goto error;
- }
-
- error = content_factory_register_handler(html_mime_types[i],
+ for (i = 0; i < NOF_ELEMENTS(html_types); i++) {
+ error = content_factory_register_handler(html_types[i],
&html_content_handler);
if (error != NSERROR_OK)
goto error;
@@ -185,15 +176,10 @@ error:
void html_fini(void)
{
- uint32_t i;
-
- for (i = 0; i < NOF_ELEMENTS(html_mime_types); i++) {
- if (html_mime_types[i] != NULL)
- lwc_string_unref(html_mime_types[i]);
- }
-
- if (html_charset != NULL)
+ if (html_charset != NULL) {
lwc_string_unref(html_charset);
+ html_charset = NULL;
+ }
}
/**
diff --git a/render/textplain.c b/render/textplain.c
index 1b1876786..786fe21e0 100644
--- a/render/textplain.c
+++ b/render/textplain.c
@@ -148,7 +148,6 @@ static const content_handler textplain_content_handler = {
.no_share = true,
};
-static lwc_string *textplain_mime_type;
static lwc_string *textplain_charset;
static lwc_string *textplain_default_charset;
@@ -160,15 +159,9 @@ nserror textplain_init(void)
lwc_error lerror;
nserror error;
- lerror = lwc_intern_string("text/plain", SLEN("text/plain"),
- &textplain_mime_type);
- if (lerror != lwc_error_ok)
- return NSERROR_NOMEM;
-
lerror = lwc_intern_string("charset", SLEN("charset"),
&textplain_charset);
if (lerror != lwc_error_ok) {
- lwc_string_unref(textplain_mime_type);
return NSERROR_NOMEM;
}
@@ -176,16 +169,14 @@ nserror textplain_init(void)
&textplain_default_charset);
if (lerror != lwc_error_ok) {
lwc_string_unref(textplain_charset);
- lwc_string_unref(textplain_mime_type);
return NSERROR_NOMEM;
}
- error = content_factory_register_handler(textplain_mime_type,
+ error = content_factory_register_handler("text/plain",
&textplain_content_handler);
if (error != NSERROR_OK) {
lwc_string_unref(textplain_default_charset);
lwc_string_unref(textplain_charset);
- lwc_string_unref(textplain_mime_type);
}
return error;
@@ -196,9 +187,15 @@ nserror textplain_init(void)
*/
void textplain_fini(void)
{
- lwc_string_unref(textplain_default_charset);
- lwc_string_unref(textplain_charset);
- lwc_string_unref(textplain_mime_type);
+ if (textplain_default_charset != NULL) {
+ lwc_string_unref(textplain_default_charset);
+ textplain_default_charset = NULL;
+ }
+
+ if (textplain_charset != NULL) {
+ lwc_string_unref(textplain_charset);
+ textplain_charset = NULL;
+ }
}
/**