Use corestrings for fetch module's lwc strings.

This commit is contained in:
Michael Drake 2014-01-24 19:25:07 +00:00
parent 72510f550b
commit c4e2fff5a4
3 changed files with 7 additions and 23 deletions

View File

@ -45,6 +45,7 @@
#include "content/fetchers/file.h"
#include "content/urldb.h"
#include "desktop/netsurf.h"
#include "utils/corestrings.h"
#include "utils/nsoption.h"
#include "utils/log.h"
#include "utils/messages.h"
@ -97,10 +98,6 @@ static struct fetch *queue_ring = 0; /**< Ring of queued fetches */
#define fetch_ref_fetcher(F) F->refcount++
/* Static lwc_strings */
static lwc_string *fetch_http_lwc;
static lwc_string *fetch_https_lwc;
/******************************************************************************
* fetch internals *
******************************************************************************/
@ -241,20 +238,6 @@ static void fetch_dispatch_jobs(void)
/* exported interface documented in content/fetch.h */
nserror fetch_init(void)
{
if (lwc_intern_string("http", SLEN("http"), &fetch_http_lwc) !=
lwc_error_ok) {
LOG(("Failed to initialise the fetch module "
"(couldn't intern \"http\")."));
return NSERROR_INIT_FAILED;
}
if (lwc_intern_string("https", SLEN("https"), &fetch_https_lwc) !=
lwc_error_ok) {
LOG(("Failed to initialise the fetch module "
"(couldn't intern \"https\")."));
return NSERROR_INIT_FAILED;
}
fetch_curl_register();
fetch_data_register();
fetch_file_register();
@ -278,9 +261,6 @@ void fetch_quit(void)
}
fetch_unref_fetcher(fetchers);
}
lwc_string_unref(fetch_http_lwc);
lwc_string_unref(fetch_https_lwc);
}
/* exported interface documented in content/fetch.h */
@ -383,11 +363,11 @@ struct fetch * fetch_start(nsurl *url, nsurl *referer,
&match) != lwc_error_ok) {
match = false;
}
if (lwc_string_isequal(scheme, fetch_https_lwc,
if (lwc_string_isequal(scheme, corestring_lwc_https,
&match1) != lwc_error_ok) {
match1 = false;
}
if (lwc_string_isequal(ref_scheme, fetch_http_lwc,
if (lwc_string_isequal(ref_scheme, corestring_lwc_http,
&match2) != lwc_error_ok) {
match2= false;
}

View File

@ -59,6 +59,7 @@ lwc_string *corestring_lwc_head;
lwc_string *corestring_lwc_hidden;
lwc_string *corestring_lwc_hr;
lwc_string *corestring_lwc_html;
lwc_string *corestring_lwc_http;
lwc_string *corestring_lwc_https;
lwc_string *corestring_lwc_iframe;
lwc_string *corestring_lwc_image;
@ -307,6 +308,7 @@ void corestrings_fini(void)
CSS_LWC_STRING_UNREF(hidden);
CSS_LWC_STRING_UNREF(hr);
CSS_LWC_STRING_UNREF(html);
CSS_LWC_STRING_UNREF(http);
CSS_LWC_STRING_UNREF(https);
CSS_LWC_STRING_UNREF(iframe);
CSS_LWC_STRING_UNREF(image);
@ -579,6 +581,7 @@ nserror corestrings_init(void)
CSS_LWC_STRING_INTERN(hidden);
CSS_LWC_STRING_INTERN(hr);
CSS_LWC_STRING_INTERN(html);
CSS_LWC_STRING_INTERN(http);
CSS_LWC_STRING_INTERN(https);
CSS_LWC_STRING_INTERN(iframe);
CSS_LWC_STRING_INTERN(image);

View File

@ -63,6 +63,7 @@ extern lwc_string *corestring_lwc_head;
extern lwc_string *corestring_lwc_hidden;
extern lwc_string *corestring_lwc_hr;
extern lwc_string *corestring_lwc_html;
extern lwc_string *corestring_lwc_http;
extern lwc_string *corestring_lwc_https;
extern lwc_string *corestring_lwc_iframe;
extern lwc_string *corestring_lwc_image;