summaryrefslogtreecommitdiff
path: root/content/urldb.c
diff options
context:
space:
mode:
authorRob Kendrick (humdrum) <rob.kendrick@codethink.co.uk>2013-05-20 09:19:31 +0100
committerRob Kendrick (humdrum) <rob.kendrick@codethink.co.uk>2013-05-20 09:19:31 +0100
commit90d2c8c2127a91634722cf243cd492998a4c9148 (patch)
tree8a4d7ebbbf85d86acefee4adec45818f1cdaf69c /content/urldb.c
parentbb08964f2726a168b77dfe147bbec1b737215aa9 (diff)
downloadnetsurf-90d2c8c2127a91634722cf243cd492998a4c9148.tar.gz
netsurf-90d2c8c2127a91634722cf243cd492998a4c9148.tar.bz2
Use hash generated by nsurl rather than doing it ourselves
Diffstat (limited to 'content/urldb.c')
-rw-r--r--content/urldb.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/content/urldb.c b/content/urldb.c
index c52dc5b76..059c3c687 100644
--- a/content/urldb.c
+++ b/content/urldb.c
@@ -461,11 +461,6 @@ void urldb_load(const char *filename)
(port ? ports : ""),
s);
- if (url_bloom != NULL)
- bloom_insert_str(url_bloom,
- url,
- strlen(url));
-
/* TODO: store URLs in pre-parsed state, and make
* a nsurl_load to generate the nsurl more
* swiftly.
@@ -476,6 +471,11 @@ void urldb_load(const char *filename)
die("Memory exhausted whilst loading "
"URL file");
}
+
+ if (url_bloom != NULL) {
+ uint32_t hash = nsurl_hash(nsurl);
+ bloom_insert_hash(url_bloom, hash);
+ }
/* Copy and merge path/query strings */
if (nsurl_get(nsurl, NSURL_PATH | NSURL_QUERY,
@@ -806,9 +806,10 @@ bool urldb_add_url(nsurl *url)
if (url_bloom == NULL)
url_bloom = bloom_create(BLOOM_SIZE);
- if (url_bloom != NULL)
- bloom_insert_str(url_bloom, nsurl_access(url),
- nsurl_length(url));
+ if (url_bloom != NULL) {
+ uint32_t hash = nsurl_hash(url);
+ bloom_insert_hash(url_bloom, hash);
+ }
/* Copy and merge path/query strings */
if (nsurl_get(url, NSURL_PATH | NSURL_QUERY, &path_query, &len) !=
@@ -1885,13 +1886,12 @@ struct path_data *urldb_find_url(nsurl *url)
assert(url);
- if (url_bloom != NULL) {
- if (bloom_search_str(url_bloom,
- nsurl_access(url),
- nsurl_length(url)) == false) {
- return NULL;
- }
- }
+ if (url_bloom != NULL) {
+ if (bloom_search_hash(url_bloom,
+ nsurl_hash(url)) == false) {
+ return NULL;
+ }
+ }
scheme = nsurl_get_component(url, NSURL_SCHEME);
if (scheme == NULL)