aboutsummaryrefslogtreecommitdiffstats
path: root/ui-refs.c
diff options
context:
space:
mode:
authorGravatar Jason A. Donenfeld <Jason@zx2c4.com>2013-03-21 04:21:25 (JST)
committerGravatar Jason A. Donenfeld <Jason@zx2c4.com>2013-03-21 04:21:25 (JST)
commit0255821e22678d4c58c809efe17bf2798835d5b9 (patch)
treed4679ff23796406648cf83ff0b98940ba844c5e1 /ui-refs.c
parent6d8a789d61f3a682bc040f1f7f44050b1f723546 (diff)
parent59fe348deaa270434f05afc56ca8d13618af9ca9 (diff)
downloadcgit-0255821e22678d4c58c809efe17bf2798835d5b9.zip
cgit-0255821e22678d4c58c809efe17bf2798835d5b9.tar.gz
Merge branch 'wip'
Diffstat (limited to 'ui-refs.c')
-rw-r--r--ui-refs.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/ui-refs.c b/ui-refs.c
index ce06b08..e89f836 100644
--- a/ui-refs.c
+++ b/ui-refs.c
@@ -103,6 +103,7 @@ static void print_tag_downloads(const struct cgit_repo *repo, const char *ref)
103 const struct cgit_snapshot_format* f; 103 const struct cgit_snapshot_format* f;
104 char *filename; 104 char *filename;
105 const char *basename; 105 const char *basename;
106 int free_ref = 0;
106 107
107 if (!ref || strlen(ref) < 2) 108 if (!ref || strlen(ref) < 2)
108 return; 109 return;
@@ -111,8 +112,10 @@ static void print_tag_downloads(const struct cgit_repo *repo, const char *ref)
111 if (prefixcmp(ref, basename) != 0) { 112 if (prefixcmp(ref, basename) != 0) {
112 if ((ref[0] == 'v' || ref[0] == 'V') && isdigit(ref[1])) 113 if ((ref[0] == 'v' || ref[0] == 'V') && isdigit(ref[1]))
113 ref++; 114 ref++;
114 if (isdigit(ref[0])) 115 if (isdigit(ref[0])) {
115 ref = xstrdup(fmt("%s-%s", basename, ref)); 116 ref = xstrdup(fmt("%s-%s", basename, ref));
117 free_ref = 1;
118 }
116 } 119 }
117 120
118 for (f = cgit_snapshot_formats; f->suffix; f++) { 121 for (f = cgit_snapshot_formats; f->suffix; f++) {
@@ -122,6 +125,9 @@ static void print_tag_downloads(const struct cgit_repo *repo, const char *ref)
122 cgit_snapshot_link(filename, NULL, NULL, NULL, NULL, filename); 125 cgit_snapshot_link(filename, NULL, NULL, NULL, NULL, filename);
123 html("&nbsp;&nbsp;"); 126 html("&nbsp;&nbsp;");
124 } 127 }
128
129 if (free_ref)
130 free((char *)ref);
125} 131}
126static int print_tag(struct refinfo *ref) 132static int print_tag(struct refinfo *ref)
127{ 133{
@@ -205,6 +211,8 @@ void cgit_print_branches(int maxcount)
205 211
206 if (maxcount < list.count) 212 if (maxcount < list.count)
207 print_refs_link("heads"); 213 print_refs_link("heads");
214
215 cgit_free_reflist_inner(&list);
208} 216}
209 217
210void cgit_print_tags(int maxcount) 218void cgit_print_tags(int maxcount)
@@ -229,6 +237,8 @@ void cgit_print_tags(int maxcount)
229 237
230 if (maxcount < list.count) 238 if (maxcount < list.count)
231 print_refs_link("tags"); 239 print_refs_link("tags");
240
241 cgit_free_reflist_inner(&list);
232} 242}
233 243
234void cgit_print_refs() 244void cgit_print_refs()