diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2009-01-30 19:09:26 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2009-01-30 19:09:26 +0000 |
commit | ffe288e50b07e95ee02cc6c8db83ec2d3c8b9b36 (patch) | |
tree | 7f8f5b7be32e7d49a3dbc1309c30968515c622a2 | |
parent | a2fbddea6016ce3532d0484d5d06ebbbf9caa927 (diff) | |
download | netsurf-ffe288e50b07e95ee02cc6c8db83ec2d3c8b9b36.tar.gz netsurf-ffe288e50b07e95ee02cc6c8db83ec2d3c8b9b36.tar.bz2 |
This logic looked entirely wrong. Fix it to be more sane. If this breaks things, blame the lack of commentary.
svn path=/trunk/netsurf/; revision=6301
-rw-r--r-- | content/urldb.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/content/urldb.c b/content/urldb.c index fc320966a..d85680ed4 100644 --- a/content/urldb.c +++ b/content/urldb.c @@ -1144,11 +1144,7 @@ void urldb_iterate_partial(const char *prefix, if (!h) { int len = slash - prefix; - if ((len == 1 && tolower(host[0]) != 'w') || - (len == 2 && (tolower(host[0]) != 'w' || - tolower(host[1]) != 'w')) || - (len >= 3 && - strncasecmp(host, "www", 3))) { + if (len <= 3 || strncasecmp(host, "www.", 4) != 0) { snprintf(buf, sizeof buf, "www.%s", host); h = urldb_search_find( search_trees[ST_DN + 'w' - 'a'], @@ -1173,11 +1169,7 @@ void urldb_iterate_partial(const char *prefix, if (!urldb_iterate_partial_host(tree, prefix, callback)) return; - if ((len == 1 && tolower(prefix[0]) != 'w') || - (len == 2 && (tolower(prefix[0]) != 'w' || - tolower(prefix[1]) != 'w')) || - (len >= 3 && - strncasecmp(prefix, "www", 3))) { + if (len <= 3 || strncasecmp(prefix, "www.", 4) != 0) { /* now look for www.prefix */ snprintf(buf, sizeof buf, "www.%s", prefix); if(!urldb_iterate_partial_host( @@ -1197,8 +1189,7 @@ void urldb_iterate_partial(const char *prefix, * \return true to continue, false otherwise */ bool urldb_iterate_partial_host(struct search_node *root, const char *prefix, - bool (*callback)(const char *url, - const struct url_data *data)) + bool (*callback)(const char *url, const struct url_data *data)) { int c; |