diff options
author | Lars Hjemli | 2006-12-16 14:58:20 +0100 |
---|---|---|
committer | Lars Hjemli | 2006-12-16 14:58:20 +0100 |
commit | aaa24bdd30303128bded8487cd9f63b54c3b8dcd (patch) | |
tree | 0fd8b32643c205d819f98a827eca3e78fad21bfa | |
parent | Simplify ui-commit.c (diff) | |
download | cgit-aaa24bdd30303128bded8487cd9f63b54c3b8dcd.tar.gz cgit-aaa24bdd30303128bded8487cd9f63b54c3b8dcd.zip |
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
diff --git a/cgit.h b/cgit.h index f06a941..02cc26a 100644 --- a/cgit.h +++ b/cgit.h | |||
@@ -65,6 +65,8 @@ extern void cgit_global_config_cb(const char *name, const char *value); | |||
65 | extern void cgit_repo_config_cb(const char *name, const char *value); | 65 | extern void cgit_repo_config_cb(const char *name, const char *value); |
66 | extern void cgit_querystring_cb(const char *name, const char *value); | 66 | extern void cgit_querystring_cb(const char *name, const char *value); |
67 | 67 | ||
68 | extern void *cgit_free_commitinfo(struct commitinfo *info); | ||
69 | |||
68 | extern char *fmt(const char *format,...); | 70 | extern char *fmt(const char *format,...); |
69 | 71 | ||
70 | extern void html(const char *txt); | 72 | extern void html(const char *txt); |
diff --git a/shared.c b/shared.c index 4574120..b576df8 100644 --- a/shared.c +++ b/shared.c | |||
@@ -88,3 +88,13 @@ void cgit_querystring_cb(const char *name, const char *value) | |||
88 | } | 88 | } |
89 | } | 89 | } |
90 | 90 | ||
91 | void *cgit_free_commitinfo(struct commitinfo *info) | ||
92 | { | ||
93 | free(info->author); | ||
94 | free(info->author_email); | ||
95 | free(info->committer); | ||
96 | free(info->committer_email); | ||
97 | free(info->subject); | ||
98 | free(info); | ||
99 | return NULL; | ||
100 | } | ||
diff --git a/ui-commit.c b/ui-commit.c index b441e14..f654208 100644 --- a/ui-commit.c +++ b/ui-commit.c | |||
@@ -61,8 +61,5 @@ void cgit_print_commit(const char *hex) | |||
61 | html("<div class='commit-msg'>"); | 61 | html("<div class='commit-msg'>"); |
62 | html_txt(info->msg); | 62 | html_txt(info->msg); |
63 | html("</div>"); | 63 | html("</div>"); |
64 | free(info->author); | 64 | cgit_free_commitinfo(info); |
65 | free(info->committer); | ||
66 | free(info->subject); | ||
67 | free(info); | ||
68 | } | 65 | } |
diff --git a/ui-log.c b/ui-log.c index c52af79..b7da49f 100644 --- a/ui-log.c +++ b/ui-log.c | |||
@@ -28,10 +28,7 @@ void print_commit(struct commit *commit) | |||
28 | html("</td><td>"); | 28 | html("</td><td>"); |
29 | html_txt(info->author); | 29 | html_txt(info->author); |
30 | html("</td></tr>\n"); | 30 | html("</td></tr>\n"); |
31 | free(info->author); | 31 | cgit_free_commitinfo(info); |
32 | free(info->committer); | ||
33 | free(info->subject); | ||
34 | free(info); | ||
35 | } | 32 | } |
36 | 33 | ||
37 | 34 | ||
diff --git a/ui-summary.c b/ui-summary.c index 8ff3642..5ddeee3 100644 --- a/ui-summary.c +++ b/ui-summary.c | |||
@@ -35,6 +35,7 @@ static int cgit_print_branch_cb(const char *refname, const unsigned char *sha1, | |||
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); |