From 201dcddff8cd53f83ac1ff3b2957fdf0bbfa5582 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Wed, 5 Oct 2011 20:22:56 +0000 Subject: [PATCH] Port disabled :visited support to nsurl. svn path=/trunk/netsurf/; revision=12961 --- css/select.c | 40 +++++++++++++++------------------------- 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/css/select.c b/css/select.c index 1ec675e1f..a192078bc 100644 --- a/css/select.c +++ b/css/select.c @@ -1418,41 +1418,31 @@ css_error node_is_visited(void *pw, void *node, bool *match) xmlNode *n = node; if (strcasecmp((const char *) n->name, "a") == 0) { - char *url, *nurl; - url_func_result res; + nsurl *url; + nserror error; + const struct url_data *data; xmlChar *href = xmlGetProp(n, (const xmlChar *) "href"); if (href == NULL) return CSS_OK; /* Make href absolute */ - res = url_join((const char *) href, ctx->base_url, &url); + /* TODO: this duplicates what we do for box->href */ + error = nsurl_join(ctx->base_url, (const char *)href, &url); xmlFree(href); - - if (res == URL_FUNC_NOMEM) { + if (error != NSERROR_OK) { return CSS_NOMEM; - } else if (res == URL_FUNC_OK) { - /* Normalize it */ - res = url_normalize(url, &nurl); - - free(url); - - if (res == URL_FUNC_NOMEM) { - return CSS_NOMEM; - } else if (res == URL_FUNC_OK) { - const struct url_data *data; - - data = urldb_get_url_data(nurl); - - /* Visited if in the db and has - * non-zero visit count */ - if (data != NULL && data->visits > 0) - *match = true; - - free(nurl); - } } + + data = urldb_get_url_data(nsurl_access(url)); + + /* Visited if in the db and has + * non-zero visit count */ + if (data != NULL && data->visits > 0) + *match = true; + + nsurl_unref(url); } #endif