summaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2012-10-06 14:07:34 +0100
committerMichael Drake <tlsa@netsurf-browser.org>2012-10-06 14:07:34 +0100
commit29ad56b4b239dfafd9f15a0499d496798bd061d7 (patch)
tree3d8ddd7451a382ca2acc2cdd76a6e5eb1afe4f1c /content
parent40343b740d1b6d28ccf2083d22f3569606aedf62 (diff)
downloadnetsurf-29ad56b4b239dfafd9f15a0499d496798bd061d7.tar.gz
netsurf-29ad56b4b239dfafd9f15a0499d496798bd061d7.tar.bz2
Use nsurl_parent.
Diffstat (limited to 'content')
-rw-r--r--content/fetchers/file.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/content/fetchers/file.c b/content/fetchers/file.c
index 73bfbdb3b..4c02c0c60 100644
--- a/content/fetchers/file.c
+++ b/content/fetchers/file.c
@@ -48,6 +48,7 @@
#include "content/urldb.h"
#include "desktop/netsurf.h"
#include "desktop/options.h"
+#include "utils/errors.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/url.h"
@@ -493,10 +494,9 @@ static void fetch_file_process_dir(struct fetch_file_context *ctx,
char buffer[1024]; /* Output buffer */
bool even = false; /* formatting flag */
char *title; /* pretty printed title */
- url_func_result res; /* result from url routines */
- char *up; /* url of parent */
+ nserror err; /* result from url routines */
+ nsurl *up; /* url of parent */
char *path; /* url for list entries */
- bool compare; /* result of url compare */
DIR *scandir; /* handle for enumerating the directory */
struct dirent* ent; /* leaf directory entry */
@@ -541,16 +541,17 @@ static void fetch_file_process_dir(struct fetch_file_context *ctx,
goto fetch_file_process_dir_aborted;
/* Print parent directory link */
- res = url_parent(nsurl_access(ctx->url), &up);
- if (res == URL_FUNC_OK) {
- res = url_compare(nsurl_access(ctx->url), up, false, &compare);
- if ((res == URL_FUNC_OK) && compare == false) {
- dirlist_generate_parent_link(up, buffer, sizeof buffer);
+ err = nsurl_parent(ctx->url, &up);
+ if (err == NSERROR_OK) {
+ if (nsurl_compare(ctx->url, up, NSURL_COMPLETE) == false) {
+ /* different URL; have parent */
+ dirlist_generate_parent_link(nsurl_access(up),
+ buffer, sizeof buffer);
msg.data.header_or_data.len = strlen(buffer);
fetch_file_send_callback(&msg, ctx);
}
- free(up);
+ nsurl_unref(up);
if (ctx->aborted)
goto fetch_file_process_dir_aborted;