diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2011-09-15 22:31:16 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2011-09-15 22:31:16 +0000 |
commit | 3d71da088b83c2cc5741dfdc8f619fbf2bba55a2 (patch) | |
tree | 8c26b93479c4a23b657c55809ea823f7b2bc2ca5 /render/textplain.c | |
parent | 50508a6e75e8bfa955b9193f0b6252ff2e235220 (diff) | |
download | netsurf-3d71da088b83c2cc5741dfdc8f619fbf2bba55a2.tar.gz netsurf-3d71da088b83c2cc5741dfdc8f619fbf2bba55a2.tar.bz2 |
Clean up content_factory_register_handler API -- content handlers no longer use the mime type, so don't require it to be interned up front
svn path=/trunk/netsurf/; revision=12796
Diffstat (limited to 'render/textplain.c')
-rw-r--r-- | render/textplain.c | 23 |
1 files changed, 10 insertions, 13 deletions
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; + } } /** |