From mboxrd@z Thu Jan 1 00:00:00 1970 From: andy at warmcat.com (Andy Green) Date: Tue, 19 Jun 2018 17:01:41 +0800 Subject: [PATCH v3 03/17] Use string list strdup_strings for mimetypes In-Reply-To: <152939875224.4492.4288866616332837866.stgit@mail.warmcat.com> References: <152939875224.4492.4288866616332837866.stgit@mail.warmcat.com> Message-ID: <152939890169.4492.18427208195554156861.stgit@mail.warmcat.com> From: John Keeping There's no need to do this manually with the string list API will do it for us. Signed-off-by: John Keeping --- cgit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cgit.c b/cgit.c index 223dfc8..0c9f3e9 100644 --- a/cgit.c +++ b/cgit.c @@ -23,7 +23,7 @@ static void add_mimetype(const char *name, const char *value) { struct string_list_item *item; - item = string_list_insert(&ctx.cfg.mimetypes, xstrdup(name)); + item = string_list_insert(&ctx.cfg.mimetypes, name); item->util = xstrdup(value); } @@ -414,7 +414,7 @@ static void prepare_context(void) ctx.page.modified = time(NULL); ctx.page.expires = ctx.page.modified; ctx.page.etag = NULL; - memset(&ctx.cfg.mimetypes, 0, sizeof(struct string_list)); + string_list_init(&ctx.cfg.mimetypes, 1); if (ctx.env.script_name) ctx.cfg.script_name = xstrdup(ctx.env.script_name); if (ctx.env.query_string)