From 3d71da088b83c2cc5741dfdc8f619fbf2bba55a2 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Thu, 15 Sep 2011 22:31:16 +0000 Subject: Clean up content_factory_register_handler API -- content handlers no longer use the mime type, so don't require it to be interned up front svn path=/trunk/netsurf/; revision=12796 --- amiga/icon.c | 43 ++----------------------------------------- 1 file changed, 2 insertions(+), 41 deletions(-) (limited to 'amiga/icon.c') diff --git a/amiga/icon.c b/amiga/icon.c index c05950e92..4fd1b2fc8 100644 --- a/amiga/icon.c +++ b/amiga/icon.c @@ -97,47 +97,8 @@ static const char *amiga_icon_types[] = { "image/x-amiga-icon" }; -static lwc_string *amiga_icon_mime_types[NOF_ELEMENTS(amiga_icon_types)]; - -nserror amiga_icon_init(void) -{ - uint32_t i; - lwc_error lerror; - nserror error; - - for (i = 0; i < NOF_ELEMENTS(amiga_icon_mime_types); i++) { - lerror = lwc_intern_string(amiga_icon_types[i], - strlen(amiga_icon_types[i]), - &amiga_icon_mime_types[i]); - if (lerror != lwc_error_ok) { - error = NSERROR_NOMEM; - goto error; - } - - error = content_factory_register_handler( - amiga_icon_mime_types[i], - &amiga_icon_content_handler); - if (error != NSERROR_OK) - goto error; - } - - return NSERROR_OK; - -error: - amiga_icon_fini(); - - return error; -} - -void amiga_icon_fini(void) -{ - uint32_t i; - - for (i = 0; i < NOF_ELEMENTS(amiga_icon_mime_types); i++) { - if (amiga_icon_mime_types[i] != NULL) - lwc_string_unref(amiga_icon_mime_types[i]); - } -} +CONTENT_FACTORY_REGISTER_TYPES(amiga_icon, amiga_icon_types, + amiga_icon_content_handler) nserror amiga_icon_create(const content_handler *handler, lwc_string *imime_type, const http_parameter *params, -- cgit v1.2.3