diff options
author | John Keeping | 2018-06-20 18:12:09 +0800 |
---|---|---|
committer | Jason A. Donenfeld | 2018-06-27 19:28:16 +0200 |
commit | c4fbb99cee30fa295e240b429b2dc7e8ad83d535 (patch) | |
tree | e382956cf34eade40b62ece2e77f34f0a6696ad8 | |
parent | 9086260329a88594474a30e0c2f6e44ae0c149ab (diff) | |
download | cgit-c4fbb99cee30fa295e240b429b2dc7e8ad83d535.tar.gz cgit-c4fbb99cee30fa295e240b429b2dc7e8ad83d535.tar.bz2 cgit-c4fbb99cee30fa295e240b429b2dc7e8ad83d535.zip |
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>
-rw-r--r-- | cgit.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -23,7 +23,7 @@ static void add_mimetype(const char *name, const char *value) | |||
23 | { | 23 | { |
24 | struct string_list_item *item; | 24 | struct string_list_item *item; |
25 | 25 | ||
26 | item = string_list_insert(&ctx.cfg.mimetypes, xstrdup(name)); | 26 | item = string_list_insert(&ctx.cfg.mimetypes, name); |
27 | item->util = xstrdup(value); | 27 | item->util = xstrdup(value); |
28 | } | 28 | } |
29 | 29 | ||
@@ -414,7 +414,7 @@ static void prepare_context(void) | |||
414 | ctx.page.modified = time(NULL); | 414 | ctx.page.modified = time(NULL); |
415 | ctx.page.expires = ctx.page.modified; | 415 | ctx.page.expires = ctx.page.modified; |
416 | ctx.page.etag = NULL; | 416 | ctx.page.etag = NULL; |
417 | memset(&ctx.cfg.mimetypes, 0, sizeof(struct string_list)); | 417 | string_list_init(&ctx.cfg.mimetypes, 1); |
418 | if (ctx.env.script_name) | 418 | if (ctx.env.script_name) |
419 | ctx.cfg.script_name = xstrdup(ctx.env.script_name); | 419 | ctx.cfg.script_name = xstrdup(ctx.env.script_name); |
420 | if (ctx.env.query_string) | 420 | if (ctx.env.query_string) |