author | Lars Hjemli <hjemli@gmail.com> | 2006-12-16 13:58:20 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2006-12-16 13:58:20 (UTC) |
commit | aaa24bdd30303128bded8487cd9f63b54c3b8dcd (patch) (side-by-side diff) | |
tree | 0fd8b32643c205d819f98a827eca3e78fad21bfa | |
parent | fa82b03e05366e3c6ca1b74c8c83d6e00e0ef1e6 (diff) | |
download | cgit-aaa24bdd30303128bded8487cd9f63b54c3b8dcd.zip cgit-aaa24bdd30303128bded8487cd9f63b54c3b8dcd.tar.gz cgit-aaa24bdd30303128bded8487cd9f63b54c3b8dcd.tar.bz2 |
Add cgit_free_commitinfo() and use where needed
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | cgit.h | 2 | ||||
-rw-r--r-- | shared.c | 10 | ||||
-rw-r--r-- | ui-commit.c | 5 | ||||
-rw-r--r-- | ui-log.c | 5 | ||||
-rw-r--r-- | ui-summary.c | 1 |
5 files changed, 15 insertions, 8 deletions
@@ -62,12 +62,14 @@ extern int cgit_query_ofs; extern int htmlfd; extern void cgit_global_config_cb(const char *name, const char *value); extern void cgit_repo_config_cb(const char *name, const char *value); extern void cgit_querystring_cb(const char *name, const char *value); +extern void *cgit_free_commitinfo(struct commitinfo *info); + extern char *fmt(const char *format,...); extern void html(const char *txt); extern void htmlf(const char *format,...); extern void html_txt(char *txt); extern void html_attr(char *txt); @@ -85,6 +85,16 @@ void cgit_querystring_cb(const char *name, const char *value) cgit_query_has_sha1 = 1; } else if (!strcmp(name, "ofs")) { cgit_query_ofs = atoi(value); } } +void *cgit_free_commitinfo(struct commitinfo *info) +{ + free(info->author); + free(info->author_email); + free(info->committer); + free(info->committer_email); + free(info->subject); + free(info); + return NULL; +} diff --git a/ui-commit.c b/ui-commit.c index b441e14..f654208 100644 --- a/ui-commit.c +++ b/ui-commit.c @@ -58,11 +58,8 @@ void cgit_print_commit(const char *hex) html("<div class='commit-subject'>"); html_txt(info->subject); html("</div>"); html("<div class='commit-msg'>"); html_txt(info->msg); html("</div>"); - free(info->author); - free(info->committer); - free(info->subject); - free(info); + cgit_free_commitinfo(info); } @@ -25,16 +25,13 @@ void print_commit(struct commit *commit) html_link_open(url, NULL, NULL); html_txt(info->subject); html_link_close(); html("</td><td>"); html_txt(info->author); html("</td></tr>\n"); - free(info->author); - free(info->committer); - free(info->subject); - free(info); + cgit_free_commitinfo(info); } void cgit_print_log(const char *tip, int ofs, int cnt) { struct rev_info rev; diff --git a/ui-summary.c b/ui-summary.c index 8ff3642..5ddeee3 100644 --- a/ui-summary.c +++ b/ui-summary.c @@ -32,12 +32,13 @@ static int cgit_print_branch_cb(const char *refname, const unsigned char *sha1, html_link_open(url, NULL, NULL); html_txt(info->subject); html_link_close(); html("</td><td>"); html_txt(info->author); html("</td></tr>\n"); + cgit_free_commitinfo(info); } else { html("<tr><td>"); html_txt(buf); html("</td><td>"); htmlf("*** bad ref %s", sha1_to_hex(sha1)); html("</td></tr>\n"); |