about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohn Keeping <john@keeping.me.uk>2018-03-31 15:11:05 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2018-06-27 18:11:19 +0200
commit71d14d9c98c39a6683780060f84429a3a7e5b348 (patch)
tree12c3a446f63c1e8ed756ffc8a76b4e4daa4f5d6b
parentui-shared: pass separator in to cgit_print_snapshot_links() (diff)
downloadcgit-magenta-71d14d9c98c39a6683780060f84429a3a7e5b348.tar.xz
ui-refs: use shared function to print tag downloads
cgit_compose_snapshot_prefix() is identical to print_tag_downloads(), so
remove the latter and use the function from ui-shared.c instead.

Signed-off-by: John Keeping <john@keeping.me.uk>
Reviewed-by: Christian Hesse <mail@eworm.de>
-rw-r--r--ui-refs.c27
1 files changed, 1 insertions, 26 deletions
diff --git a/ui-refs.c b/ui-refs.c

index 7b95e8b..2ec3858 100644 --- a/ui-refs.c +++ b/ui-refs.c
@@ -90,31 +90,6 @@ static void print_tag_header(void) "<th class='left' colspan='2'>Age</th></tr>\n"); } -static void print_tag_downloads(const struct cgit_repo *repo, const char *ref) -{ - const struct cgit_snapshot_format* f; - const char *basename; - struct strbuf filename = STRBUF_INIT; - size_t prefixlen; - - basename = cgit_snapshot_prefix(repo); - if (starts_with(ref, basename)) - strbuf_addstr(&filename, ref); - else - cgit_compose_snapshot_prefix(&filename, basename, ref); - prefixlen = filename.len; - for (f = cgit_snapshot_formats; f->suffix; f++) { - if (!(repo->snapshots & f->bit)) - continue; - strbuf_setlen(&filename, prefixlen); - strbuf_addstr(&filename, f->suffix); - cgit_snapshot_link(filename.buf, NULL, NULL, NULL, NULL, filename.buf); - html("&nbsp;&nbsp;"); - } - - strbuf_release(&filename); -} - static int print_tag(struct refinfo *ref) { struct tag *tag = NULL; @@ -134,7 +109,7 @@ static int print_tag(struct refinfo *ref) cgit_tag_link(name, NULL, NULL, name); html("</td><td>"); if (ctx.repo->snapshots && (obj->type == OBJ_COMMIT)) - print_tag_downloads(ctx.repo, name); + cgit_print_snapshot_links(ctx.repo, name, "&nbsp;&nbsp;"); else cgit_object_link(obj); html("</td><td>");