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) (unidiff) | |
tree | 0fd8b32643c205d819f98a827eca3e78fad21bfa /ui-summary.c | |
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-- | ui-summary.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/ui-summary.c b/ui-summary.c index 8ff3642..5ddeee3 100644 --- a/ui-summary.c +++ b/ui-summary.c | |||
@@ -1,62 +1,63 @@ | |||
1 | /* ui-summary.c: functions for generating repo summary page | 1 | /* ui-summary.c: functions for generating repo summary page |
2 | * | 2 | * |
3 | * Copyright (C) 2006 Lars Hjemli | 3 | * Copyright (C) 2006 Lars Hjemli |
4 | * | 4 | * |
5 | * Licensed under GNU General Public License v2 | 5 | * Licensed under GNU General Public License v2 |
6 | * (see COPYING for full license text) | 6 | * (see COPYING for full license text) |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include "cgit.h" | 9 | #include "cgit.h" |
10 | 10 | ||
11 | static int cgit_print_branch_cb(const char *refname, const unsigned char *sha1, | 11 | static int cgit_print_branch_cb(const char *refname, const unsigned char *sha1, |
12 | int flags, void *cb_data) | 12 | int flags, void *cb_data) |
13 | { | 13 | { |
14 | struct commit *commit; | 14 | struct commit *commit; |
15 | struct commitinfo *info; | 15 | struct commitinfo *info; |
16 | char buf[256], *url; | 16 | char buf[256], *url; |
17 | 17 | ||
18 | commit = lookup_commit(sha1); | 18 | commit = lookup_commit(sha1); |
19 | if (commit && !parse_commit(commit)){ | 19 | if (commit && !parse_commit(commit)){ |
20 | info = cgit_parse_commit(commit); | 20 | info = cgit_parse_commit(commit); |
21 | html("<tr><td>"); | 21 | html("<tr><td>"); |
22 | url = cgit_pageurl(cgit_query_repo, "log", | 22 | url = cgit_pageurl(cgit_query_repo, "log", |
23 | fmt("h=%s", refname)); | 23 | fmt("h=%s", refname)); |
24 | html_link_open(url, NULL, NULL); | 24 | html_link_open(url, NULL, NULL); |
25 | strncpy(buf, refname, sizeof(buf)); | 25 | strncpy(buf, refname, sizeof(buf)); |
26 | html_txt(buf); | 26 | html_txt(buf); |
27 | html_link_close(); | 27 | html_link_close(); |
28 | html("</td><td>"); | 28 | html("</td><td>"); |
29 | cgit_print_date(commit->date); | 29 | cgit_print_date(commit->date); |
30 | html("</td><td>"); | 30 | html("</td><td>"); |
31 | url = cgit_pageurl(cgit_query_repo, "commit", fmt("id=%s", sha1_to_hex(sha1))); | 31 | url = cgit_pageurl(cgit_query_repo, "commit", fmt("id=%s", sha1_to_hex(sha1))); |
32 | html_link_open(url, NULL, NULL); | 32 | html_link_open(url, NULL, NULL); |
33 | html_txt(info->subject); | 33 | html_txt(info->subject); |
34 | html_link_close(); | 34 | html_link_close(); |
35 | html("</td><td>"); | 35 | html("</td><td>"); |
36 | html_txt(info->author); | 36 | html_txt(info->author); |
37 | html("</td></tr>\n"); | 37 | html("</td></tr>\n"); |
38 | cgit_free_commitinfo(info); | ||
38 | } else { | 39 | } else { |
39 | html("<tr><td>"); | 40 | html("<tr><td>"); |
40 | html_txt(buf); | 41 | html_txt(buf); |
41 | html("</td><td>"); | 42 | html("</td><td>"); |
42 | htmlf("*** bad ref %s", sha1_to_hex(sha1)); | 43 | htmlf("*** bad ref %s", sha1_to_hex(sha1)); |
43 | html("</td></tr>\n"); | 44 | html("</td></tr>\n"); |
44 | } | 45 | } |
45 | return 0; | 46 | return 0; |
46 | } | 47 | } |
47 | 48 | ||
48 | static void cgit_print_branches() | 49 | static void cgit_print_branches() |
49 | { | 50 | { |
50 | html("<table class='list'>"); | 51 | html("<table class='list'>"); |
51 | html("<tr><th class='left'>Branch</th><th class='left'>Updated</th><th class='left'>Commit subject</th><th class='left'>Author</th></tr>\n"); | 52 | html("<tr><th class='left'>Branch</th><th class='left'>Updated</th><th class='left'>Commit subject</th><th class='left'>Author</th></tr>\n"); |
52 | for_each_branch_ref(cgit_print_branch_cb, NULL); | 53 | for_each_branch_ref(cgit_print_branch_cb, NULL); |
53 | html("</table>"); | 54 | html("</table>"); |
54 | } | 55 | } |
55 | 56 | ||
56 | void cgit_print_summary() | 57 | void cgit_print_summary() |
57 | { | 58 | { |
58 | html("<h2>"); | 59 | html("<h2>"); |
59 | html_txt("Repo summary page"); | 60 | html_txt("Repo summary page"); |
60 | html("</h2>"); | 61 | html("</h2>"); |
61 | cgit_print_branches(); | 62 | cgit_print_branches(); |
62 | } | 63 | } |