From 81c52ad4947c2b658473f8f87e244660a72c002a Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Sat, 27 Aug 2011 08:43:51 +0000 Subject: Initial image content handler refactor svn path=/trunk/netsurf/; revision=12671 --- image/rsvg.c | 51 +++++---------------------------------------------- 1 file changed, 5 insertions(+), 46 deletions(-) (limited to 'image/rsvg.c') diff --git a/image/rsvg.c b/image/rsvg.c index 5af3c1bc2..678cd862d 100644 --- a/image/rsvg.c +++ b/image/rsvg.c @@ -56,16 +56,6 @@ typedef struct rsvg_content { struct bitmap *bitmap; /**< Created NetSurf bitmap */ } rsvg_content; - - -static const char *rsvg_types[] = { - "image/svg", - "image/svg+xml" -}; - -static lwc_string *rsvg_mime_types[NOF_ELEMENTS(rsvg_types)]; - - static nserror rsvg_create_svg_data(rsvg_content *c) { union content_msg_data msg_data; @@ -318,43 +308,12 @@ static const content_handler rsvg_content_handler = { .no_share = false, }; -nserror nsrsvg_init(void) -{ - uint32_t i; - lwc_error lerror; - nserror error; - - for (i = 0; i < NOF_ELEMENTS(rsvg_mime_types); i++) { - lerror = lwc_intern_string(rsvg_types[i], - strlen(rsvg_types[i]), - &rsvg_mime_types[i]); - if (lerror != lwc_error_ok) { - error = NSERROR_NOMEM; - goto error; - } - - error = content_factory_register_handler(rsvg_mime_types[i], - &rsvg_content_handler); - if (error != NSERROR_OK) - goto error; - } - - return NSERROR_OK; - -error: - nsrsvg_fini(); - - return error; -} +static const char *rsvg_types[] = { + "image/svg", + "image/svg+xml" +}; -void nsrsvg_fini(void) -{ - uint32_t i; +CONTENT_FACTORY_REGISTER_TYPES(nsrsvg, rsvg_types, rsvg_content_handler); - for (i = 0; i < NOF_ELEMENTS(rsvg_mime_types); i++) { - if (rsvg_mime_types[i] != NULL) - lwc_string_unref(rsvg_mime_types[i]); - } -} #endif /* WITH_RSVG */ -- cgit v1.2.3