all repos — cgit @ c4fbb99cee30fa295e240b429b2dc7e8ad83d535

a hyperfast web frontend for git written in c

Use string list strdup_strings for mimetypes

There's no need to do this manually with the string list API will do it
for us.

Signed-off-by: John Keeping <john@keeping.me.uk>
John Keeping john@keeping.me.uk
Wed, 20 Jun 2018 18:12:09 +0800
commit

c4fbb99cee30fa295e240b429b2dc7e8ad83d535

parent

9086260329a88594474a30e0c2f6e44ae0c149ab

1 files changed, 2 insertions(+), 2 deletions(-)

jump to
M cgit.ccgit.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 @@ ctx.page.size = 0;

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)