From: list at eworm.de (Christian Hesse)
Subject: [PATCH 2/2] ui-stats: do not duplicate string
Date: Mon, 12 Oct 2015 10:59:35 +0200 [thread overview]
Message-ID: <1444640375-13895-2-git-send-email-list@eworm.de> (raw)
In-Reply-To: <1444640375-13895-1-git-send-email-list@eworm.de>
From: Christian Hesse <mail at eworm.de>
string_list_insert() expects (const char*), so no need to duplicate and
free the string.
Signed-off-by: Christian Hesse <mail at eworm.de>
---
ui-stats.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/ui-stats.c b/ui-stats.c
index 02335e7..26473de 100644
--- a/ui-stats.c
+++ b/ui-stats.c
@@ -171,24 +171,19 @@ static void add_commit(struct string_list *authors, struct commit *commit,
struct string_list_item *author, *item;
struct authorstat *authorstat;
struct string_list *items;
- char *tmp;
struct tm *date;
time_t t;
info = cgit_parse_commit(commit);
- tmp = xstrdup(info->author);
- author = string_list_insert(authors, tmp);
+ author = string_list_insert(authors, info->author);
if (!author->util)
author->util = xcalloc(1, sizeof(struct authorstat));
- free(tmp);
authorstat = author->util;
items = &authorstat->list;
t = info->committer_date;
date = gmtime(&t);
period->trunc(date);
- tmp = xstrdup(period->pretty(date));
- item = string_list_insert(items, tmp);
- free(tmp);
+ item = string_list_insert(items, period->pretty(date));
item->util++;
authorstat->total++;
cgit_free_commitinfo(info);
--
2.6.1
next prev parent reply other threads:[~2015-10-12 8:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-12 8:59 [PATCH 1/2] ui-stats: free without condition list
2015-10-12 8:59 ` list [this message]
2015-10-12 9:11 ` [PATCH 2/2] ui-stats: do not duplicate string john
2015-10-12 9:10 ` [PATCH 1/2] ui-stats: free without condition john
2015-10-12 9:14 ` list
2015-10-12 18:29 ` list
2015-10-12 20:29 ` john
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1444640375-13895-2-git-send-email-list@eworm.de \
--to=cgit@lists.zx2c4.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).