summaryrefslogtreecommitdiff
path: root/content/fetchers/resource.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2014-06-19 18:27:24 +0100
committerVincent Sanders <vince@kyllikki.org>2014-06-19 18:27:24 +0100
commit4b2101ba6ab62ae26d82cc8b86e0e61e9c007156 (patch)
treee46413e8f7a99d68f26f4b6e4f898b8400758933 /content/fetchers/resource.c
parent904cefd388aa613126b69c858e489c5867163a87 (diff)
downloadnetsurf-4b2101ba6ab62ae26d82cc8b86e0e61e9c007156.tar.gz
netsurf-4b2101ba6ab62ae26d82cc8b86e0e61e9c007156.tar.bz2
clean up the fetcher factory and improve its API
Diffstat (limited to 'content/fetchers/resource.c')
-rw-r--r--content/fetchers/resource.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/content/fetchers/resource.c b/content/fetchers/resource.c
index 664c45720..18e302140 100644
--- a/content/fetchers/resource.c
+++ b/content/fetchers/resource.c
@@ -37,16 +37,19 @@
#include <libwapcaplet/libwapcaplet.h>
#include "utils/config.h"
-#include "content/fetch.h"
-#include "content/fetchers/resource.h"
-#include "content/urldb.h"
-#include "desktop/gui_factory.h"
+#include "utils/errors.h"
#include "utils/corestrings.h"
#include "utils/nsoption.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/utils.h"
#include "utils/ring.h"
+#include "desktop/gui_factory.h"
+
+#include "content/fetch.h"
+#include "content/fetchers.h"
+#include "content/fetchers/resource.h"
+#include "content/urldb.h"
struct fetch_resource_context;
@@ -353,17 +356,19 @@ static void fetch_resource_poll(lwc_string *scheme)
} while ( (c = next) != ring && ring != NULL);
}
-void fetch_resource_register(void)
+nserror fetch_resource_register(void)
{
lwc_string *scheme = lwc_string_ref(corestring_lwc_resource);
-
- fetch_add_fetcher(scheme,
- fetch_resource_initialise,
- fetch_resource_can_fetch,
- fetch_resource_setup,
- fetch_resource_start,
- fetch_resource_abort,
- fetch_resource_free,
- fetch_resource_poll,
- fetch_resource_finalise);
+ const struct fetcher_operation_table fetcher_ops = {
+ .initialise = fetch_resource_initialise,
+ .acceptable = fetch_resource_can_fetch,
+ .setup = fetch_resource_setup,
+ .start = fetch_resource_start,
+ .abort = fetch_resource_abort,
+ .free = fetch_resource_free,
+ .poll = fetch_resource_poll,
+ .finalise = fetch_resource_finalise
+ };
+
+ return fetcher_add(scheme, &fetcher_ops);
}