summaryrefslogtreecommitdiff
path: root/image/ico.c
diff options
context:
space:
mode:
Diffstat (limited to 'image/ico.c')
-rw-r--r--image/ico.c56
1 files changed, 8 insertions, 48 deletions
diff --git a/image/ico.c b/image/ico.c
index cae5e07f5..9f9aeb0f1 100644
--- a/image/ico.c
+++ b/image/ico.c
@@ -46,16 +46,6 @@ typedef struct nsico_content {
struct ico_collection *ico; /** ICO collection data */
} nsico_content;
-static const char *nsico_types[] = {
- "application/ico",
- "application/x-ico",
- "image/ico",
- "image/vnd.microsoft.icon",
- "image/x-icon"
-};
-
-static lwc_string *nsico_mime_types[NOF_ELEMENTS(nsico_types)];
-
static nserror nsico_create_ico_data(nsico_content *c)
{
@@ -238,44 +228,14 @@ static const content_handler nsico_content_handler = {
.no_share = false,
};
+static const char *nsico_types[] = {
+ "application/ico",
+ "application/x-ico",
+ "image/ico",
+ "image/vnd.microsoft.icon",
+ "image/x-icon"
+};
-nserror nsico_init(void)
-{
- uint32_t i;
- lwc_error lerror;
- nserror error;
-
- for (i = 0; i < NOF_ELEMENTS(nsico_mime_types); i++) {
- lerror = lwc_intern_string(nsico_types[i],
- strlen(nsico_types[i]),
- &nsico_mime_types[i]);
- if (lerror != lwc_error_ok) {
- error = NSERROR_NOMEM;
- goto error;
- }
-
- error = content_factory_register_handler(nsico_mime_types[i],
- &nsico_content_handler);
- if (error != NSERROR_OK)
- goto error;
- }
-
- return NSERROR_OK;
-
-error:
- nsico_fini();
-
- return error;
-}
-
-void nsico_fini(void)
-{
- uint32_t i;
-
- for (i = 0; i < NOF_ELEMENTS(nsico_mime_types); i++) {
- if (nsico_mime_types[i] != NULL)
- lwc_string_unref(nsico_mime_types[i]);
- }
-}
+CONTENT_FACTORY_REGISTER_TYPES(nsico, nsico_types, nsico_content_handler);
#endif