[prev in list] [next in list] [prev in thread] [next in thread]
List: cgit
Subject: [RFC/PATCH 1/5] Use string list strdup_strings for mimetypes
From: John Keeping <john () keeping ! me ! uk>
Date: 2016-09-03 18:29:32
Message-ID: 041adbb28ab9ddd9cfcd0b280bf76c8bd83d4124.1472925431.git.john () keeping ! me ! uk
[Download RAW message or body]
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>
---
This is a preliminary cleanup I noticed while in the area.
cgit.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cgit.c b/cgit.c
index 9427c4a..de0bdb8 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)
--
2.10.0.rc0.142.g1e9f63b
_______________________________________________
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic